• Post Reply Bookmark Topic Watch Topic
  • New Topic

Logout when click in button back of my tablet

 
Sarra Sakka
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
i want to know how can i logout from my application when i press the back button in my tablet?
thank you in advance
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add a key listener to your activity like this:

But why would you want to do this, instead of the user staying logged in? I can think of no mobile app where the user gets logged out like that (except for a password app, for obvious reasons). I think that might not go down well with your users.
 
Sarra Sakka
Ranch Hand
Posts: 283
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your reply,
I use a password in my application that's why ;)
 
Ulf Dittmer
Rancher
Posts: 42970
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Many apps do - but none log out the user upon quitting the app. I guess if you're the only user you won't have to deal with complaints (but might get tired of it yourself after while...) :-)
 
my overalls have superpowers - they repel people who think fashion is important. Tiny ad:
the new thread boost feature brings a LOT of attention to your favorite threads
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!