iPhone - detect first time launch with phonegap

cordova, iphone

Solution

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
}

Problem

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

Original source