I followed instruction to setup my android project with correct app_id, parse_app_id, parse_client_id. And even using ParseUI for Android to sign up a new account & logged-in. But facebook login just doesn't work!
Here's my settings:
- Import ParseLoginUI project with
compile project(':ParseLoginUI') - Add facebook sdk
compile 'com.facebook.android:facebook-android-sdk:3.23.1'&compile 'com.parse.bolts:bolts-android:1.+'
In the ParseLoginUI project its build.gradle is:
dependencies {
compile 'com.parse.bolts:bolts-android:1.1.4'
compile 'com.android.support:support-v4:22.0.0'
provided 'com.facebook.android:facebook-android-sdk:3.23.1'
// This assumes that your app's project has a compile dependency on the Parse SDK JAR files.
// Your project's build.gradle should say:
//
// compile files('YOUR_PROJECT_LIBS_PATH/Parse-1.8.4.jar')
// compile files('YOUR_PROJECT_LIBS_PATH/ParseFacebookUtils-1.8.4.jar')
//
// Since the dependency below is "provided" instead of "compile", your project's build.gradle
// does not have to refer to the same Parse SDK instance that's in the ParseLoginUI/libs folder.
provided files('libs/Parse-1.8.4.jar')
provided files('libs/ParseFacebookUtils-1.8.4.jar')
}
Clicking login button will run:
facebookLoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
ParseFacebookUtils
.logIn(getActivity(), new LogInCallback() {
@Override
public void done(ParseUser parseUser, ParseException e) {
if (isActivityDestroyed()) {
return;
}
if (parseUser == null) {
if (e != null) {
UIUtils.getSoldaToast(getActivity(), "Facebook Login failed", Gravity.CENTER).show();
Logger.d("Facebook Login failed, exception " + e.toString());
}
} else if (parseUser.isNew()) {
Request.newMeRequest(ParseFacebookUtils.getSession(),
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser fbUser,
Response response) {
/*
If we were able to successfully retrieve the Facebook
user's name, let's set it on the fullName field.
*/
ParseUser parseUser = ParseUser.getCurrentUser();
if (fbUser != null && parseUser != null
&& fbUser.getName().length() > 0) {
parseUser.put(USER_OBJECT_NAME_FIELD, fbUser.getName());
parseUser.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e != null) {
Logger.e(getString(
com.parse.ui.R.string.com_parse_ui_login_warning_facebook_login_user_update_failed) +
e.toString());
}
loginSuccess();
}
});
}
loginSuccess();
}
}
).executeAsync();
} else {
loginSuccess();
}
}
});
}
});
It always return null user & ParseException said invalid date:
checkout the doc but still don't know what I did wrong.
Is this because I should upgrade SDK up to 4.0.0?
Anyone experience this?
Any luck with it?
RépondreSupprimerAs i'm facing the same problem