How to count how many times the application has been opened?

Hi, what feature can I use to count how many times the application has been opened? I saw a video once explaining but I could not find it.

I know I could use a .txt file, or json, to read and rewrite, but there should be a easier way to do this. Can you help me?

Why should there be an easier way?  Use a txt file or json or (more tricky but preferable an online server)

is note there a persistent type of variable that can do this?

A variable is non-persistent by default (as it is instantiated in code) .

Hello…

Thanks for the feedback and consider seeing the example of “persistent variable” that I extracted and adapted from the framework.

https://github.com/ipodjms/coronaAppCounter

Using system.setPreferences()/system.getPreference() is a perfectly valid way to deal with this. Depending on the platform, this could be a value stored in a registry style database or a file, but these API calls let the OS deal with it instead of you doing your own file IO, but at the end of the day, it’s file IO.  It will save you a few lines of code.

Rob

Why should there be an easier way?  Use a txt file or json or (more tricky but preferable an online server)

is note there a persistent type of variable that can do this?

A variable is non-persistent by default (as it is instantiated in code) .

Hello…

Thanks for the feedback and consider seeing the example of “persistent variable” that I extracted and adapted from the framework.

https://github.com/ipodjms/coronaAppCounter

Using system.setPreferences()/system.getPreference() is a perfectly valid way to deal with this. Depending on the platform, this could be a value stored in a registry style database or a file, but these API calls let the OS deal with it instead of you doing your own file IO, but at the end of the day, it’s file IO.  It will save you a few lines of code.

Rob