Code to unlock and open APP

We are making an app for a health company who wants all of their patients to have this app, and are wanting to put it for free on the Apple and Android store.

But they want only their patients to be able to open it. For example the patient downloads the app, app opens and asks for code the user puts in the code which is given by the company(once and only once to open and unlock the app) and the user now has access to the app and every time they open and close out of the app, they do not want the user to have to put in a code every time. 

This would make the app free and accessible to their patients but not to anyone who randomly decides to download and look at it. 

We know how to put the lock on it and have the correct code unlock the app. How do we set it so it only needs the code once at the initial download? 

Hi @maria8,

Generally, you would just create a file that can be read when the app opens. This could be a simple text file with one value, a JSON file, or an SQlite database. When the app opens, you open the file and check a value within that file. If it’s “false” then you know the user has never logged in, so you direct them to some kind of login method. Upon successful login, you update that data value in the file, so that next time the user logs in, that file is checked and the value is “true”, and they can proceed to use the app.

This guide should help you get started:

http://docs.coronalabs.com/guide/data/readWriteFiles/index.html

Also, you may want to check out “GGData”, a module which easily handles data for you.

https://github.com/GlitchGames/GGData

Take care,

Brent

Hi @maria8,

Generally, you would just create a file that can be read when the app opens. This could be a simple text file with one value, a JSON file, or an SQlite database. When the app opens, you open the file and check a value within that file. If it’s “false” then you know the user has never logged in, so you direct them to some kind of login method. Upon successful login, you update that data value in the file, so that next time the user logs in, that file is checked and the value is “true”, and they can proceed to use the app.

This guide should help you get started:

http://docs.coronalabs.com/guide/data/readWriteFiles/index.html

Also, you may want to check out “GGData”, a module which easily handles data for you.

https://github.com/GlitchGames/GGData

Take care,

Brent