I am building an app with codename one
So, I basically want to send a SMS the first time a user installs the app.
SO i do it this way.
1)Check if a “firstRUN” storage file exists.
2)If it does not, create that file and send SMS. If it does, just start the app.
SO far, so good.
But now the dilemma is:
If the user already has my app installed, and he installs a newer version of my app,android asks if my app has to be upgraded. Now if the user says yes:
1)my application gets upgraded and then starts
2)It checks if the storage file “firstRUN” exists. In this case, it does exist because the application has been upgraded and existing storage files were not deleted.
What I wish to do is, incase my application is upgraded, I would like to delete the existing storage files for that application. How do i do this?
Ok, and is it right what I am doing here ? Is there a better way to do this ?
Instead of checking whether the file exists just store a version number within the file and when upgrading act according to the version number.