Check Facebook button login on Android

Asked

Viewed 485 times

0

Good evening, I’m new to programming, I’m starting now. My question is the following, I started studying the Facebook Login API, she is logging in normally and forwarding to the next Activity, so far so good. The problem is when I close the application and open again, it starts in the first Activity with the "quit" button of the API itself, after logging out and logging in again it forwards me to the next Activity. Would it be possible to save the login, so when the application is restarted it checks if it is already logged forward to the second Activity? Thank you!

1 answer

0


The "Sign Out" button indicates that you are already logged in, when you click Sign Out you just log out of the app and login again, what you need to do is check whether its identifier is null or not, if it is not means that there is already a logged in user. If you are already logged in you quit Splashactivity for Homeacitivy for example. If you are not logged in you quit Splashactivity for Loginactivity.

AccessToken.getCurrentAccessToken();

Don’t forget to start facebook sdk.

  • So it would be more or less like this? if(Accesstoken.getCurrentAccessToken() != null) { Intent Intent = new Intent(Login.this, Segundaactivity.class); startActivity(Intent); Finish();

  • exactly not needing the user to have to leave and log in again

  • Opa worked, but now there’s another problem... Before storing the token, the APP would take the profile photo and user name right after login, now when I have the token stored it opens in the second Activity without making the photo and name requests. Do I have to cache them? But I think this is happening because I’m checking the token in onCreate before the app fetches the information

  • Try this https://gist.github.com/jcaiqueoliveira/9ea00f70f32a945621d7

Browser other questions tagged

You are not signed in. Login or sign up in order to post.