Reputation: 16837
I need to write a application which has login functionality. It needs to have user name and password. Once a user logs in I need to switch to an activity that displays data from a REST API.
However I want to know the right way to implement this. I'm thinking that if I login and switch to the next activity, then the first login activity should no longer be reachable unless user logs out. Also I'm thinking that the data activity should not be exported and login might (?) be exported.
Can anyone suggest the right way to implement this ?
Upvotes: 0
Views: 43
Reputation: 8641
Your suggestion is one way to approach this, but it's a bit "brute force".
Is there a reason that users have to log in each time they use the app? Why don't you store the credentials, at least as an option (that is, provide a "Remember me" option?).
For example, the only way to use the Gmail app is to add your Google account credentials first. Once you've done that, you no longer have to provide your email and password when you look at mail. The Gmail app assumes that you've protected access to your phone.
Remember that, for a mobile device, entering text is tedious and error-prone. On the whole, it's best to do it once and store it securely.
Upvotes: 1