1

i am relative new with android developement.

I'm trying to create a small application that connects via google +.

I have two activity. The first contains the login and the second the main app . I was able to log in and start the second activity follow android wiki.

The problem is that I can not run the log out of the second activity .

What I want to achieve is something similar to the runtastic login .

Can anyone give me some suggestions , I have tried a lot on the net but have not found anything that could help me.

theShadow89
  • 1,307
  • 20
  • 44

1 Answers1

-1

i recommend for you, Simply

http://www.androidhive.info/2014/02/android-login-with-google-plus-account-1/

first just you login, when you logged save the instance value 1 in sqlite database. when you want to logout just use that value to 0.

It work well, i mostly use this way for login and logout. It might be useful.

one more way you can do this using broadcast receiver.

whenever you press logout pass broadcast message and get that message in all activity and make it finish using that message.

This is the best and simple way to logout from any activity.

Thankyou hope this will help you and many more :)

Saveen
  • 4,120
  • 14
  • 38
  • 41
  • your example use only one activity. – theShadow89 Oct 12 '14 at 22:18
  • what do you want to do ? you can login with one activity then logout any other, it depends on you.. – Saveen Oct 13 '14 at 10:54
  • I want login on first activity (login Activity) and then log-out from second activity (Main Activity) , somthing like runtastic (do you know it ? ). – theShadow89 Oct 13 '14 at 11:01
  • Dude I told you same thing.. First you save value in database like sqlite.and when you want to logout then that value to 0.I'll make you totorial today.. Then I'll update you proper.. – Saveen Oct 13 '14 at 15:35
  • the problem is that I also have to disconnect the user from google calling the disconnect method. This method can only be called by the login activity but when it starts re-run part of the connection and call onconnected method tath restart second activity. I have found a trick to obviate at this ,but does not seem very fair. I can post to you my code. – theShadow89 Oct 13 '14 at 15:59
  • You post your, I'll check and change according to thatHie – Saveen Oct 13 '14 at 16:39
  • 1
    I solved following this: http://stackoverflow.com/questions/22368520/how-to-correctly-use-google-plus-sign-in-with-multiple-activities/22464950# . I have create a base activity tath implement connect/disconnect command. Other activity extend tath. – theShadow89 Oct 13 '14 at 21:51