本文整理汇总了Java中com.parse.ParseFacebookUtils类的典型用法代码示例。如果您正苦于以下问题:Java ParseFacebookUtils类的具体用法?Java ParseFacebookUtils怎么用?Java ParseFacebookUtils使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ParseFacebookUtils类属于com.parse包,在下文中一共展示了ParseFacebookUtils类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: signInFB
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
private void signInFB() {
List<String> permissions = Arrays.asList(
"public_profile", "email");
ParseFacebookUtils.logInWithReadPermissionsInBackground(getActivity(), permissions, new LogInCallback() {
@Override
public void done(ParseUser parseUser, ParseException e) {
Log.d(TAG, "logInWithReadPermissionsInBackground done");
if (e == null) {
boolean fullyRegistered = parseUser.getBoolean(ParseTables.Users.FULLY_REGISTERED);
if (parseUser == null)
Log.d("MyApp", "Uh oh. The user cancelled the Facebook login.");
else if(!fullyRegistered || parseUser.isNew()) {
getFacebookData();
} else {
Utils.goToMainActivity(getActivity());
}
} else {
e.printStackTrace();
}
}
});
}
开发者ID:championswimmer,项目名称:Bookd_Android_App,代码行数:23,代码来源:SignOnFragment.java
示例2: setUpFacebookLogin
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
private void setUpFacebookLogin() {
facebookLoginButton.setVisibility(View.VISIBLE);
if (config.getFacebookLoginButtonText() != null) {
facebookLoginButton.setText(config.getFacebookLoginButtonText());
}
facebookLoginButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
loadingStart(false); // Facebook login pop-up already has a spinner
if (config.isFacebookLoginNeedPublishPermissions()) {
ParseFacebookUtils.logInWithPublishPermissionsInBackground(getActivity(),
config.getFacebookLoginPermissions(), facebookLoginCallbackV4);
} else {
ParseFacebookUtils.logInWithReadPermissionsInBackground(getActivity(),
config.getFacebookLoginPermissions(), facebookLoginCallbackV4);
}
}
});
}
开发者ID:LibertACAO,项目名称:libertacao-android,代码行数:22,代码来源:ParseLoginFragment.java
示例3: setupParse
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
private void setupParse() {
Parse.initialize(this, getString(R.string.parse_app_id), getString(R.string.parse_client_key));
ParseFacebookUtils.initialize(this);
if(ParseUser.getCurrentUser() != null && !UserPreferences.isUserAssociatedWithInstallation()) {
// This should be done only once
ParseInstallation currentInstallation = ParseInstallation.getCurrentInstallation();
currentInstallation.put("user", ParseUser.getCurrentUser());
currentInstallation.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if(e != null) {
Timber.d("Error when trying to associate user with installation: " + e.getLocalizedMessage());
} else {
Timber.d("User successfully associated with installation");
UserPreferences.setUserAssociatedWithInstallation();
}
}
});
}
}
开发者ID:LibertACAO,项目名称:libertacao-android,代码行数:21,代码来源:MyApp.java
示例4: onActivityResult
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
Log.w(TAG, "onActivityResult called");
if (requestCode == RC_SIGN_IN) {
if (resultCode != -1) {
mSignInClicked = false;
}
mIntentInProgress = false;
if (!mGoogleApiClient.isConnecting()) {
mGoogleApiClient.connect();
}
}
ParseFacebookUtils.onActivityResult(requestCode, resultCode, data);
}
开发者ID:teamOSC,项目名称:Studddinv2_android,代码行数:18,代码来源:SignOnFragment.java
示例5: setUpFacebookLogin
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
private void setUpFacebookLogin() {
facebookLoginButton.setVisibility(View.VISIBLE);
if (config.getFacebookLoginButtonText() != null) {
facebookLoginButton.setText(config.getFacebookLoginButtonText());
}
facebookLoginButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
loadingStart(false); // Facebook login pop-up already has a spinner
if (config.isFacebookLoginNeedPublishPermissions()) {
ParseFacebookUtils.logInWithPublishPermissionsInBackground(getActivity(),
config.getFacebookLoginPermissions(), facebookLoginCallbackV4);
} else {
ParseFacebookUtils.logInWithReadPermissionsInBackground(getActivity(),
config.getFacebookLoginPermissions(), facebookLoginCallbackV4);
}
}
});
}
开发者ID:zeshan321,项目名称:SyncNotes,代码行数:22,代码来源:ParseLoginFragment.java
示例6: onCreate
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
loginButton = (Button) findViewById(R.id.loginButton);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Log.i(AnypicApplication.TAG, "Login button clicked");
onLoginButtonClicked();
}
});
// Check if there is a currently logged in user
// and they are linked to a Facebook account.
ParseUser currentUser = ParseUser.getCurrentUser();
if ((currentUser != null) && ParseFacebookUtils.isLinked(currentUser)) {
// Go to the main photo list view activity
showHomeListActivity();
}
// For push notifications
ParseAnalytics.trackAppOpened(getIntent());
}
开发者ID:salmank888,项目名称:Anypic-Android,代码行数:26,代码来源:LoginActivity.java
示例7: onLoginButtonClicked
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
private void onLoginButtonClicked() {
LoginActivity.this.progressDialog = ProgressDialog.show(
LoginActivity.this, "", "Logging in...", true);
List<String> permissions = Arrays.asList("public_profile","user_about_me","user_friends");
ParseFacebookUtils.logIn(permissions, this, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
LoginActivity.this.progressDialog.dismiss();
if (user == null) {
Log.i(AnypicApplication.TAG,
"Uh oh. The user cancelled the Facebook login.");
} else if (user.isNew()) {
Log.i(AnypicApplication.TAG,
"User signed up and logged in through Facebook!");
showHomeListActivity();
} else {
Log.i(AnypicApplication.TAG,
"User logged in through Facebook!");
showHomeListActivity();
}
}
});
}
开发者ID:salmank888,项目名称:Anypic-Android,代码行数:24,代码来源:LoginActivity.java
示例8: retrieveEmailAddress
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
public void retrieveEmailAddress() {
Request request = Request.newMeRequest(ParseFacebookUtils.getSession(),
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
try {
String email = user.getInnerJSONObject().get("email").toString();
ParseUser.getCurrentUser().setEmail(email);
ParseUser.getCurrentUser().saveEventually();
} catch (JSONException e) {
Log.e("CatChatInbox", "Failed to parse JSON from FB", e);
}
}
}
}
);
request.executeAsync();
}
开发者ID:cat-chat,项目名称:cat-chat-android,代码行数:22,代码来源:CatChatApplication.java
示例9: onActivityResult
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
if (resultCode == RESULT_OK && requestCode == CONTACT_PICKER_RESULT) {
Contact c = getEmailAddress(data);
if (c != null) {
sendMessage("toEmail", c.email());
}
} else if (resultCode == RESULT_OK && requestCode == PICK_FB_CONTACT) {
String fbId = data.getExtras().getString("fbid");
if (!TextUtils.isEmpty(fbId)) {
sendMessage("toFacebook", fbId);
}
} else if (resultCode == RESULT_OK && requestCode == 32665) {
ParseFacebookUtils.finishAuthentication(requestCode, resultCode, data);
} else {
super.onActivityResult(requestCode, resultCode, data);
}
}
开发者ID:cat-chat,项目名称:cat-chat-android,代码行数:21,代码来源:SendCatMessageActivity.java
示例10: ensureUserIsLoggedInToFacebookAndPresentFriendPicker
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
private void ensureUserIsLoggedInToFacebookAndPresentFriendPicker() {
Session fbSession = Session.getActiveSession();
if (fbSession == null || !fbSession.isOpened() || !ParseFacebookUtils.isLinked(ParseUser.getCurrentUser())) {
mProgressDialog = CatProgressDialog.show(SendCatMessageActivity.this, getString(R.string.logging_in));
final List<String> permissions = Utils.getFBPermissions();
ParseFacebookUtils.link(ParseUser.getCurrentUser(), permissions, SendCatMessageActivity.this, new SaveCallback() {
@Override
public void done(ParseException e) {
SendCatMessageActivity.this.mProgressDialog.dismiss();
presentFriendPicker();
}
});
} else {
presentFriendPicker();
}
}
开发者ID:cat-chat,项目名称:cat-chat-android,代码行数:19,代码来源:SendCatMessageActivity.java
示例11: onLoginButtonClicked
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
private void onLoginButtonClicked() {
mProgressDialog = CatProgressDialog.show(MainActivity.this, getString(R.string.logging_in));
List<String> permissions = Utils.getFBPermissions();
ParseFacebookUtils.logIn(permissions, this, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
MainActivity.this.mProgressDialog.dismiss();
if (user == null) {
Log.d("CatChatLogin", "User cancelled Facebook login");
} else {
if(currentUserHasNoEmailAddress()) {
((CatChatApplication)getApplication()).retrieveEmailAddress();
}
Utils.mapInstallationToCurrentUser();
showInboxActivity();
}
}
});
}
开发者ID:cat-chat,项目名称:cat-chat-android,代码行数:22,代码来源:MainActivity.java
示例12: showProfile
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
/**
* Shows the profile of the given user.
*
* @param user
*/
private void showProfile(ParseUser user) {
if (user != null) {
String fullName = user.getString("name");
String email = user.getString("email");
getActionBar().setTitle("Profile");
boolean isFacebookLinkedUser=ParseFacebookUtils.isLinked(user);
email = user.getString("email");
if (isFacebookLinkedUser) {
setEmail();
} else {
showDonorInformaiton(fullName,email,false);
}
}
}
开发者ID:rutvijkumarshah,项目名称:WatsiAndroidApp,代码行数:25,代码来源:DonorProfileActivity.java
示例13: setEmail
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
public void setEmail() {
Request.newMeRequest(ParseFacebookUtils.getSession(),
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
ImageLoader imgImageLoader = ImageLoader.getInstance();
imgImageLoader.displayImage(
"http://graph.facebook.com/" + user.getId()
+ "/picture?type=large", profilePicture);
String email = user.asMap().get("email").toString();
showDonorInformaiton(user.getName(),email,true);
}
}).executeAsync();
}
开发者ID:rutvijkumarshah,项目名称:WatsiAndroidApp,代码行数:18,代码来源:DonorProfileActivity.java
示例14: createBuyerChannel
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
private void createBuyerChannel() {
final Session session = ParseFacebookUtils.getSession();
if (session != null && session.isOpened()) {
Request request = Request.newMeRequest(session, new Request.GraphUserCallback() {
@Override public void onCompleted(GraphUser user, Response response) {
if (session == Session.getActiveSession()) {
if (user != null) {
facebookId = user.getId();
String c = buyerProfile != null ? buyerProfile + adId : facebookId + adId;
subscribeChannel(c);
publishMessage(c, facebookId, adId);
}
}
}
});
Request.executeBatchAsync(request);
}
}
开发者ID:kamoljan,项目名称:ShopAfter,代码行数:19,代码来源:ViewActivity.java
示例15: getPhotos
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
public void getPhotos(){
new Request(
ParseFacebookUtils.getSession(),
"/me/photos",
null,
HttpMethod.GET,
new Request.Callback() {
public void onCompleted(Response response) {
GraphObject obj = response.getGraphObject();
JSONArray array =(JSONArray) obj.getProperty("data");
//Only save valid photo array
if(array != null && array.length() > 0) {
ParseUser.getCurrentUser().put(Enums.ParseKey.USER_FB_PHOTOS, array.toString());
ParseUser.getCurrentUser().saveInBackground();
}
}
}
).executeAsync();
}
开发者ID:DobrinAlexandru,项目名称:Wabbit-Messenger---android-client,代码行数:20,代码来源:FBMgr.java
示例16: onCreate
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
@Override public void onCreate() {
super.onCreate();
Parse.initialize(this, "aTAL8FkWWQRG2bsilzCzwQpVMY2YCK8skFryZIFa", "vLefUWhxBk12E8X4oighFYt25iGnMYRTUP58RDJg");
ParseFacebookUtils.initialize(getString(R.string.app_id));
PushService.setDefaultPushCallback(this, ViewActivity.class);
ParseInstallation.getCurrentInstallation().saveInBackground();
if (BuildConfig.DEBUG) {
Timber.plant(new DebugTree());
} else {
// TODO Crashlytics.start(this);
// TODO Timber.plant(new CrashlyticsTree());
}
applicationGraph = ObjectGraph.create(getModules().toArray());
}
开发者ID:kamoljan,项目名称:Nefete,代码行数:18,代码来源:NefeteApp.java
示例17: onResume
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
@Override
protected void onResume(){
super.onResume();
if ((currentUser != null) && ParseFacebookUtils.isLinked(currentUser)) {
//user logged in through facebook
try {
if(currentUser.has("myPetProfile")){
petProfile = currentUser.getParseObject("myPetProfile").fetchIfNeeded();
profilePicture = petProfile.getParseFile("profilePicture");
}
Log.d(TAG, "retrieved petProfile");
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d(TAG,"error fetching");
}
getParseUserData();
} else {
Log.d(TAG,"user not logged in");
}
}
开发者ID:dmeyer3691,项目名称:PetTinder,代码行数:22,代码来源:EditProfileActivity.java
示例18: onCreate
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Parse.initialize(this, "bl9sFBxmrkDhNWSDxnlvbLIbeFrQ9kHUGEbBRI4a", "tCzPn6RbPx2ZJUmGc7AMb2eBoetXgO02A4jefTHp");
ParseFacebookUtils.initialize(getString(R.string.facebook_app_id));
setContentView(R.layout.activity_main);
//define intents
settingsIntent = new Intent(this, SettingsActivity.class);
gps = new GPSManager(MainActivity.this);
// register buttons
loginButton = (Button) findViewById(R.id.facebookLoginButton);
loginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
onLoginButtonClicked();
}
});
Log.d(TAG, "Called onCreate");
}
开发者ID:dmeyer3691,项目名称:PetTinder,代码行数:24,代码来源:MainActivity.java
示例19: onResume
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
@Override
protected void onResume(){
super.onResume();
if ((currentUser != null) && ParseFacebookUtils.isLinked(currentUser)) {
//user logged in through facebook
try {
if (currentUser.has("myPetProfile")){
petProfile = currentUser.getParseObject("myPetProfile").fetchIfNeeded();
}
Log.d(TAG, "retrieved petProfile");
} catch (ParseException e) {
// TODO Auto-generated catch block
e.printStackTrace();
Log.d(TAG,"error fetching");
}
getParseUserData();
} else {
Log.d(TAG,"user not logged in");
}
}
开发者ID:dmeyer3691,项目名称:PetTinder,代码行数:24,代码来源:MyProfileActivity.java
示例20: onCreate
import com.parse.ParseFacebookUtils; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_settings);
//define intents
mainIntent = new Intent(this, MainActivity.class);
deleteButton = (Button) findViewById(R.id.delete_account_button);
deleteButton.setOnClickListener(delete);
logoutButton = (Button) findViewById(R.id.logout_button);
logoutButton.setOnClickListener(logout);
// Check if there is a currently logged in user
// and it's linked to a Facebook account.
currentUser = ParseUser.getCurrentUser();
profilePic = (ProfilePictureView) findViewById(R.id.facebookProfilePic);
profileName = (TextView) findViewById(R.id.facebookProfileName);
if ((currentUser != null) && ParseFacebookUtils.isLinked(currentUser)) {
makeMeRequest();
} else {
logoutButton.setVisibility(View.INVISIBLE);
}
Log.d(TAG, "Called OnCreate");
}
开发者ID:dmeyer3691,项目名称:PetTinder,代码行数:23,代码来源:AppSettingsActivity.java
注:本文中的com.parse.ParseFacebookUtils类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论