How to disable Facebook single sign on for android - Facebook-android-sdk
ohh, Got answer make call to authorize method with activity code FACEBOOK.FORCE_DIALOG_AUTH
mFacebook.authorize(activity, permissions, activityCode, listener);
replace activityCode with FORCE_DIALOG_AUTH
How to disable Single SIgn On for facebook android app?
See setLoginBehavior in the OpenRequest that you pass to Session.openFor[Read|Publish] - https://developers.facebook.com/docs/reference/android/3.0/Session.OpenRequest#setLoginBehavior%28SessionLoginBehavior%29
You can set it to SUPPRESS_SSO which will use the web dialog instead of SSO - https://developers.facebook.com/docs/reference/android/3.0/SessionLoginBehavior#SUPPRESS_SSO
how disable automatic logging with facebook
To Log out user from facebook after some action use
if (Profile.getCurrentProfile() != null && AccessToken.getCurrentAccessToken() != null) {
//there is an active user,just Log out the user
LoginManager.getInstance().logOut();
}
How to make facebook app with Single Sign On enabled?
To create Facebook App, with Android support, you should follow this official tutorial.
If you already have one, and configured it with your Android app, you should go to the App Dashboard, select your app, open "Settings", and in Android section turn "Single Sign-On" to enabled.
Prevent network requests from Facebook Android SDK
I have noticed that the Facebook SDK (at least in version 4.33) adds a provider (com.facebook.internal.FacebookInitProvider
) in the manifest of your app, which automatically calls FacebookSdk.sdkInitialize
with the application context.
Even if you have added:
<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="false" />
in your manifest, at least 2 requests will be made to Facebook:
- a graph request to get app settings
- an Events request "
fb_sdk_initialize
" which logs all the Facebook frameworks that are included into your app
So to prevent these requests (that we don't want as long as the user didn't allow them (GDPR)), I think you did everything we need to do:
- Do not add
<meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/facebook_app_id"/>
in the manifest - Add
<meta-data android:name="com.facebook.sdk.AutoLogAppEventsEnabled" android:value="false"/>
in the manifest - Only initialize Facebook SDK when you need it.
Like this for example:
FacebookSdk.setApplicationId(<context>.getString(R.string.facebook_app_id));
FacebookSdk.sdkInitialize(<context>);
AppEventsLogger logger = AppEventsLogger.newLogger(<context>); // I don't use FB Login for my project but app events.
But regarding your crash, I don't know why it happens since it seems that the broadcast "com.facebook.sdk.ACTION_CURRENT_ACCESS_TOKEN_CHANGED
" is sent locally.
Nevertheless, I think you can prevent it by adding this to your manifest:
<provider
android:name="com.facebook.internal.FacebookInitProvider"
tools:node="remove" />
<receiver
android:name="com.facebook.CurrentAccessTokenExpirationBroadcastReceiver"
tools:node="remove" />
However, doing this may have bad consequences with the use of Facebook SDK and I think you will have to provide (and register in your manifest) your own BroadcastReceiver:
public class CustomCurrentAccessTokenExpirationBroadcastReceiver extends BroadcastReceiver {
@Override
public void onReceive(Context context, Intent intent) {
if (AccessTokenManager.ACTION_CURRENT_ACCESS_TOKEN_CHANGED.equals(intent.getAction())) {
new CurrentAccessTokenExpirationBroadcastReceiver().onReceive(context, intent); // Call it only if you have initialized the Facebook SDK!
}
}
}
Make Android app forget Facebook login
These settings are saved for each user. You can't revoke the permissions from anyone meaning the users need to deauthorize your app themselves.
On Facebook or in the Facebook app go into Settings -> Account settings -> Apps (colorful box icon) -> Logged in with Facebook. Here find your app, click on it and click Remove app.
This will revoke the permissions you gave the app with your Facebook user and next time you log in with Facebook in your app it will ask for permissions.
Related Topics
Play Sound Using Soundpool Example
Android Background Drawable Not Working in Button Since Android Studio 4.1
Highlight Listview Selected Row
Naming My Application in Android
"Gps" Location Provider Requires Access_Fine_Location Permission for Android 6.0
Android Listview Row Delete Animation
Find Current Location Latitude and Longitude in Android
Error "Activity Class Does Not Exist" When Launching Android App with Adb Shell Am Start
What's the Maximum Size for an Android Shared Preference Value
Save Data and Change Orientation
How to Create Context Menu for Recyclerview
Android Imageview Adjusting Parent's Height and Fitting Width
How to Align Android Toolbar Menu/Icons to the Left Like in Google Maps App
React-Native, Android, Genymotion: Adb Server Didn't Ack