how to make android game to run only fixed no of times

hello…Is it possible to make unity android game(free) to run for a limited number of times (say 10)and after that it promote for purchase(by locking the levels). similarly how can I display a game play tutorial only 3 times when player play the game first 3 times and after that the tutorial will not be displayed. Thanks

This is basically DRM, witch have been a headache for developers and entertainment industry for years.
In essence you would have to implements som sort of counter, and check the count when you start the game.
The problem is that you would have to store the count somewhere and there is always some smart people that figure out where it’s stored and how it’s stored, and once they do there is very litte to stop them from bypassing it.

You can store the count locally on the device, encrypt and obscufate it to make it hard for people to find and edit.
Or you can choose to store the count on a sever and require that the device is connected to the internet each time they start the game.

I suggest you read up on some of the different DRM options out there, decide what level of security you need. And use your imagination.

If you where just looking for a code snippet i guess this would be the simplest.
`

var logincount = PlayerPrefs.GetInt("LoginCount");
if(loginCount <= 3){
    // play the game
    PlayerPrefs.SetInt("LoginCount") = logincount+1;
} else {
    // redirect to purchase site
}

`

But keep in mind that playerprefs can easily be edited by the owner of the device to give him unlimited access.