Reputation: 165
I've just started to work on Parse API and I've found out that on my test device and emulator, the facebook integration doesn't work as expected.
In a onClickListener, I have this to log in with Facebook account:
...SignInActivity.onCreate()....
List<String> permissions = Arrays.asList("public_profile", "user_friends", "user_about_me",
"user_relationships", "user_birthday", "user_location");
ParseFacebookUtils.logIn(permissions, SignInActivity.this, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
progressDialog.dismiss();
if (user == null) {
Log.d("Parse",
"Uh oh. The user cancelled the Facebook login.");
} else if (user.isNew() && err == null) {
Log.d("Parse",
"User signed up and logged in through Facebook!");
startActivity(new Intent(SignInActivity.this, MainActivity.class));
} else if (err == null) {
Log.d("Parse",
"User logged in through Facebook!");
startActivity(new Intent(SignInActivity.this, MainActivity.class));
} else {
Log.d("Parse", "Login err: "+err.getMessage());
}
}
});
I do check that err is null as well and this step logs users in correctly.
Then it sends me to MainActivity but when I exit the app and open it again,
....at the end of SignInActivity.onCreate()...
ParseUser currentUser = ParseUser.getCurrentUser();
if ((currentUser != null) && ParseFacebookUtils.isLinked(currentUser)) {
startActivity(new Intent(this, MainActivity.class));
} else {
Log.d("Logging in with Facebook", "User not logged in. (currentUser != null) = " + (currentUser != null));
}
Tells me getCurrentUser() returned null.
In Application.onCreate(), I've the following code to set up Parse and ParseFacebookUtils.
Parse.initialize(this, "xxxx",
"xxxxx");
Parse.enableLocalDatastore(this);
ParseFacebookUtils.initialize(getString(R.string.app_id));
super.onCreate();
I'm using facebook sdk v3.15.0 and Parse 1.5.1
Is this a known issue or am I missing something?
Thanks for your help!
Upvotes: 0
Views: 485
Reputation: 3177
This is a known Parse 1.5.1 bug, as described here: https://developers.facebook.com/bugs/229876443869758/
There is a workaround, for now: try to disable the local datastore.
Upvotes: 1