I have an activity that handles the Facebook sign in/sign up. When I click my "Sign in with Facebook" button, I execute this code, as per the Parse docs:
ParseFacebookUtils.logIn(this, new LogInCallback() {
@Override
public void done(ParseUser user, ParseException err) {
if (user == null) {
Log.d(APPTAG, "Uh oh. The user cancelled the Facebook login.");
} else if (user.isNew()) {
Log.d(APPTAG, "User signed up and logged in through Facebook!");
} else {
Log.d(APPTAG, "User logged in through Facebook!");
}
}
});
I also have this method in my activity:
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
super.onActivityResult(requestCode, resultCode, data);
ParseFacebookUtils.finishAuthentication(requestCode, resultCode, data);
}
In my Application class, I set up Parse and ParseFacebookUtils properly:
Parse.initialize(this, getString(R.string.parse_app_id), getString(R.string.parse_client_key));
ParseFacebookUtils.initialize(getString(R.string.facebook_app_id));
I also have the Facebook App installed on my device.
The problem I have is that when I call ParseFacebookUtils.logIn(), it always returns a ParseUser that's not new or null, but that is effectivly empty. It has no objectId, createdAt, updatedAt, etc. The ParseException also is always null.
I'm also not sure why the ParseUser in the done callback has a false value for user.isNew() because there aren't any users in my _User table. Usually, the Facebook sign in should create a new ParseUser if one doesn't already exist.
I've tried uninstalling and re-installing my app but that didn't work. Even If I clear every table, in the Data Browser, clear my cache, and get a completely fresh install of my app, It never shows that the user is new.
I see nothing relevant in my Logcat as well.
I found a similar post on the Parse help forum, but there were no answers.
In my AndroidManifest, I have this:
<activity
android:name="com.facebook.LoginActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
<meta-data
android:name="com.facebook.sdk.ApplicationId"
android:value="@string/facebook_app_id" />
<activity
android:name=".activities.SignUpOrLogInActivity"
android:label="@string/app_name"
android:theme="@android:style/Theme.Black.NoTitleBar" />
The SignUpOrLogInActivity is where I have my "Sign in with Facebook" button.
0 comments:
Post a Comment