How to reset DefaultAudience when Logging Out from FB on Android - android

I'm using FB SDK to connect my App to FB. When I run the app for the first time on a particular device, when I execute the following code:
LoginManager.getInstance.logInWithReadPermissions()
LoginManager.getInstance.logInWithPublishPermissions()
The user is taken to the FB Android App and is asked if my App should be given certain user accesses. For publish permissions, the user is also given a choice to specify who should see the published content (only_me, friends, everyone, etc...)
I logout from FB via
LoginManager.getInstance.logout()
When I attempt to login again, from the same device, the App is simply connected to FB, without asking if the App should be given by FB various permissions. How can I force FB to ask the user about various login permissions upon every login. In particular, I want the user to be able to change who gets to see the published content.
I know that I can changed who gets to see the published content via
LoginManager.getInstance.setDefaultAudience()
but then, I'd have to keep track of the FB audience setting in my App.

Related

Detect current user facebook user

I have an android app that uses facebook SDK.
I have a problem with this scenario:
I use the my app for the first time then I log in my facebook account in my app. The credentials are then save in the app so that users will not be ask to log in again. Now, in the facebook app, I log out my account then log in again with a different user. When I go back to my app and retrieve the some user info, it still has the old user in it.
I tried to check it using Profile.getcurrentProfile() but it still contains info on the old user.
Is there any way to detect who's currently using the facebook app?

Stop being asked for permission each time user login with twitter account in my app

I am using febric for android twitter integration, and I could successfully login from Twitter native App to my app. But it always asks user to allow sharing account details.
Below are the screen
After i allow another screen comes
Why it asks for allow each time user login with same account, since it should be asked only for (the first) one time for each user? How can I solve it?

Dropbox API on Android: Always asking for permission to link app to Dropbox account

We're using the Dropbox Core API to access a users's Dropbox account in our Android app:
https://www.dropbox.com/developers/core/start/android
When the user starts the app for the first time, he sees the following two Dropbox screens:
Screen 1:
Screen 2:
After the first successful authentication, we store the OAuth2 session key in the SharedPreferences, and use the key for all subsequent API access.
This seems to work: When the user starts the app the second time, Screen 1 doesn't appear, so we assume that we have used the session key correctly.
However, Dropbox still displays the second screen, asking the user for permission to link the app to his Dropbox account. No matter how many times the user has given permission to link the app, Screen 2 is always shown when the app is started.
Any idea what we're doing wrong?
Found the solution:
Instead of always calling
_dropboxApi.getSession().startOAuth2Authentication(MyActivity.this);
we are now checking if the session is already linked:
if (!_dropboxApi.getSession().isLinked()) {
_dropboxApi.getSession().startOAuth2Authentication(MyActivity.this);
}

Android Facebook SDK displaying authorize dialogue on login every time

I tried to login to one of my application using Facebook Android SDK, earlier, it used to show the permissions authorize dialogue, initally and one time only when running app, and giving its Facebook app permission. But since today when I try to login, after first time asking me permission, when I login second time it display SCREEN 1 i.e. authrozie request dialogue saying that I have already authorized this app. This dialogue never user to appear earlier, I haven't done any change to code which might initiate this thing.
See attached screen shot

How logout works in Facebook SDK Android

I'm a bit confused about how facebook.logout(context) works.
Because even after calling log out, I am able to get access to information that requires an auth_token. So how is that even possible? I came across this topic, which let me a bit confused: https://stackoverflow.com/a/6597688/487940
After reading that answer, this is my question: So if the user grants access to [my] application, he will always be authenticated if he is logged into the [official] facebook application? Even if I try to call facebook.logout(context) in [my] application, he will be logged in and my application will be able to make calls to Facebook API?'
Sorry, about I'm not able to understand this behavior.
UPDATE: After reading Torid's reponse, I am confused about facebook.logout() function. What is the purpose of this function if it does not log the user out? Because, I don't see the purpose of calling this purpose anymore. It doesn't log the user out.
There are two independent things going on here: 1) whether your user has authenticated your app (with permissions) to Facebook and 2) whether your user is logged in to Facebook.
Authentication is required the first time your user uses your app and lasts until the user explicitly de-authenticates (e.g. through the Facebook web Account Settings -> Apps -> App Settings).
Log in may be required each time your user starts your app. But if you use the default SDK authorize(), that tries to do a Single Sign On (SSO), where if the Facebook app is logged in, your app is automatically logged in and uses the existing access token.
If you are using SSO, when you do a logout, that has no effect, as a real logout would have to log out the Facebook app - which the user might not like!
You can get around this behavior by doing an authorize of the form
authorize(this, PERMISSIONS, FORCE_DIALOG_AUTH, new LoginDialogListener());
which avoids SSO and forces a dialog login. Of course, that then forces your user to login each time you start your app - unless you save the login details / access token under the
covers (which is what the SDK does - check the source).

Categories

Resources