I am trying to detect the first time launch of a newly installed application and display a license agreement for the application. The user must accept the lincense or leave the application..
Does anyone know how I can do this using Phonegap? I have searched through the topics but I cant seem to find this anywhere.
Thank You
There is no way to determine the "activation date" of any given iPhone. The best you can do is find out if it's still under warranty and when the warranty expires. There is no way to determine the "activation date" of any given iPhone.
Hybrid apps are developed using web technologies: HTML5, CSS and JavaScript, then put inside a native container such Adobe PhoneGap. These native containers run the web application code and package it into an app.
PhoneGap is an Open Source framework that helps build hybrid applications which work on most mobile platforms such as Android, iOS, Blackberry, Windows Phone among others.
You can use local storage to keep track of app launch counts.
var applaunchCount = window.localStorage.getItem('launchCount');
//Check if it already exists or not
if(applaunchCount){
//This is a second time launch, and count = applaunchCount
}else{
//Local storage is not set, hence first time launch. set the local storage item
window.localStorage.setItem('launchCount',1);
//Do the other stuff related to first time launch
}
Now iOS may clear localStorage, so you cannot count on it being persistent.
For truly persistent storage, one option would be the file system plugin
https://cordova.apache.org/docs/en/latest/reference/cordova-plugin-file
Please note that if your APP is uninstalled, your persistent file would most likely be removed also. Which is probably fine for this application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With