-2

I'm working on an app that will be published on the Google Play store when finished. However, my company doesn't want everyone to be able to use the app, so they've requested that I protect it with a password so only our employees can use it. How do I make it so that my app requires a password the first time it starts only?

Xander
  • 97
  • 1
  • 12

2 Answers2

0

You could store a shared preference that shows whether the app has been opened or not. The first time the user puts the password in set the flag and then check it in your onCreate method.

Ben
  • 1,285
  • 1
  • 9
  • 15
0

Authentication is a very wide subject and I would suggest you start familiarizing yourself with it before starting implementing anything. (just a starting point...)

As for the general idea, You can use Shared Preferences to save a flag that the user has authenticated. Every time your application starts, you check this flag. If the user has never authenticated himself, you present a Login screen.

Once the user gives the proper credentials, you update the flag and indicate that the application shouldn't prompt the user with the Login screen anymore.

Community
  • 1
  • 1
David Lev
  • 813
  • 5
  • 12