The best way to do this would be to set up a MySQL database on your server and store the time and date of the installation and the device ID in it. So every time the user opens your app you check with your server how long the device is already running the app. You could do this or if you don't want to get involved in server side programming you could just create a local SQLite database and do the same(then of corse you won't have to save the device ID). However this is not so safe because the user can access your database if his/her device is rooted. Therefore if you're choosing this way I'd recommend using SQLCipher for Android. It encrypts your database.