I am working on ParseFacebookUser. From its documentation, I coded the facebook login module as follows:
@Override
protected void onResume()
{
super.onResume();
....
Parse.initialize(this, "XXX", "XXX");
ParseFacebookUtils.initialize(this);
// FB: Logs 'install' and 'app activate' App Events.
AppEventsLogger.activateApp(this);
List<String> permissions = Arrays.asList("user_birthday", "user_location", "user_friends", "email", "public_profile");
ParseFacebookUtils.logInWithReadPermissionsInBackground(this, permissions, new LogInCallback()
{
@Override
public void done(ParseUser user, ParseException err)
{
if (user == null)
{
Log.d("MyApp","Uh oh. The user cancelled the Facebook login.");
}
else if (user.isNew())
{
Log.d("MyApp", "User signed up and logged in through Facebook!");
}
else
{
Log.d("MyApp", "User logged in through Facebook!");
}
}
});
}
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/MyTheme" >
<activity
android:label="@string/app_name" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name="com.abc.user.LoginActivity" android:screenOrientation="portrait"/>
<activity android:name="com.abc.user.RegisterActivity" android:screenOrientation="portrait"/>
<activity android:name="com.abc.user.User_leaderboard" android:screenOrientation="portrait"/>
<activity android:name="com.facebook.LoginActivity"
android:theme="@android:style/Theme.Translucent.NoTitleBar" android:label="@string/app_name" /> />
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
</application>
07-12 01:13:57.488: E/AndroidRuntime(23542): Caused by: Log in attempt failed: FacebookActivity could not be started. Please make sure you added FacebookActivity to the AndroidManifest.
07-12 01:13:57.488: E/AndroidRuntime(23542): at com.facebook.login.LoginManager.startLogin(LoginManager.java:381)
07-12 01:13:57.488: E/AndroidRuntime(23542): at com.facebook.login.LoginManager.logInWithReadPermissions(LoginManager.java:261)
07-12 01:13:57.488: E/AndroidRuntime(23542): at com.parse.FacebookAuthenticationProvider.authenticateAsync(FacebookAuthenticationProvider.java:155)
07-12 01:13:57.488: E/AndroidRuntime(23542): at com.parse.ParseAuthenticationProvider.logInAsync(ParseAuthenticationProvider.java:50)
07-12 01:13:57.488: E/AndroidRuntime(23542): at com.parse.ParseFacebookUtils.logInAsync(ParseFacebookUtils.java:265)
07-12 01:13:57.488: E/AndroidRuntime(23542): at com.parse.ParseFacebookUtils.logInWithReadPermissionsInBackground(ParseFacebookUtils.java:161)
07-12 01:13:57.488: E/AndroidRuntime(23542): at com.parse.ParseFacebookUtils.logInWithReadPermissionsInBackground(ParseFacebookUtils.java:173)
07-12 01:13:57.488: E/AndroidRuntime(23542): at com.abc.abc.First.onResume(First.java:144)
07-12 01:13:57.488: E/AndroidRuntime(23542): at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1210)
07-12 01:13:57.488: E/AndroidRuntime(23542): at android.app.Activity.performResume(Activity.java:5512)
07-12 01:13:57.488: E/AndroidRuntime(23542): at android.app.ActivityThread.performResumeActivity(ActivityThread.java:2948)
07-12 01:13:57.488: E/AndroidRuntime(23542): ... 12 more
Caused by: Log in attempt failed: FacebookActivity could not be started. Please make sure you added FacebookActivity to the AndroidManifest. There is no page redirect to login of facebook. What is wrong in the above code?
Thanks!
You have not included the activity for Facebook login in the Manifest file. Add this.
<activity android:name="com.facebook.FacebookActivity"
android:configChanges=
"keyboard|keyboardHidden|screenLayout|screenSize|orientation"
android:theme="@android:style/Theme.Translucent.NoTitleBar"
android:label="@string/app_name" />
Refer Facebook Android SDK for more information.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With