Detect current user facebook user - android

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?

Related

How to reset DefaultAudience when Logging Out from FB on 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.

How to clear Firebase authdata on Facebook App revoke?

I am following the login with Facebook example for my app from here.
I have a question regarding one of the login test cases as mentioned on facebook. Here is the scenario:
First time user comes, sees the login to facebook button
Successfully logs in, sees and approves the facebook(fb) app permission screen, and I get the authdata, and some other info
User closes the app
User directly goes on Facebook and revokes the access to the fb app, approved in Step 2.
User opens the mobile app, and still able to use it, without getting the facebook login button..?
Ideally I would like to see the login button again.
How do we handle such a scenario with Firebase and Facebook together? Do I need to check something on every app restart and what all things I need to clear before new login starts?

Android - Facebook log in and Sign up

Hello I'm creating an app that there is a log in and sign up screen. In the sign up if a user sign's in using Facebook, and later log of - he will go to log in screen. There is a log in using Facebook button, and when a user tries to log in, Facebook gives me an error and Okay button. I think this is because the user already has given the app permissions(or something like that). Now my question is how can I create the log in function if a user has already signed in using Facebook.
For Login/Logout purpose you can use Facebook SDK 3.0, it uses information from Facebook App on Android (if it is installed), so if the user has already signed in using the Facebook App, then the user would not have to sign-in again, the SDK will simply fetch the current Session.
I have answered the detailed implementation for this on the link below:
Post to facebook after login fails Android
Thanks.

Using multiple sessions with androids facebook sdk?

for my App I am using the facbeook sdk to let the user login to my app.
Now I want to allow the connection between two accounts by using facebook. The problem is that I would need a new facebook-session-object that forces the user to login even if a user is logged in.
The only thing I need from that user after he logged hin: ID and AccessToken.
Any ideas?

android - auto-login with facebook sdk

I want to use the facebook sdk and be able to automatically login after the app has already logged in once.
Currently from what I can gather if you use the facebook api and you have the facebook app installed and you have signed in with the facebook app then you don't have to login and you will be automatically logged in.
But if you don't have the facebook app then this automatic login will not happen. -----------I want to handle this case and be still able to automatically log in after the user has logged in with my app once.-------------. From my understanding the facebook sdk requires you to login if the facebook app is not there.
Also if the user has logged in once with my app, I will have the access token then as long as the access token has not expired then you don't need to log in again. But if the access token expires then you have to log in again.
Any help will be appreciated. Thanks.
The functionality you're describing is called single sign on. Facebook has an entire article dedicated to describing how it works and how to implement it. Enjoy:
http://developers.facebook.com/docs/guides/mobile/android_sso/

Categories

Resources