Search code examples
cordovansuserdefaultssharedpreferences

how to store a value in Phonegap apps, any way other than database


I am a mobile developer. So far I have worked on iPhone and Android apps. Now I am working on Phone gap based apps for iPhone and Android mobiles.

Now my problem is in my app I have a login page where I have to enter the username and password. After a successful login, I return a unique token which I have to use for the whole app. If the app gets closed and opened after a long time I want this to remain the same.

For this in ios apps we use a method called UserDefault method and whereas in Android apps we have a default method called SharedPreference. In that way is there any default method for Phonegap or I have to use only the database.

Currently, I am writing a JavaScript for my phone gap apps, please give me any suggestion.


Solution

  • One option is local storage. Here is a tutorial on using local storage with PhoneGap.