1

I'm making an Android game using Unity and I want to give the player some free in-game currency the first time they play the game. To do this I need to know if this is the first time they have installed and run the game on the current device. I don't want them to be able to delete the game and reinstall it to get the welcome bonus again.

I've looked up things like shared preferences and even the keystore but from what I can gather these get deleted when uninstalling the app. I can write a file to persistent storage with a flag indicating if the game has been installed before but I don't want them to be able to delete this file and reinstall the game. The data needs to persist between app installs and needs to be hidden from the user.

Edit: In response to the possible duplicate. Shared preferences won't work because they get deleted when the app is uninstalled.

  • make a login and bind the currency to user. – Jiang YD Apr 19 '17 at 02:04
  • 1
    Try use https://docs.unity3d.com/ScriptReference/PlayerPrefs.html ... Save a key first install and save... then check again ... But i not sure when user uninstall the key is gone.... OR try google service it safe ... – Cổ Chí Tâm Apr 19 '17 at 02:09
  • I forgot to mention I want it to work offline so creating a login or using Google services won't work. I'm already using PlayerPrefs but it gets deleted along with the app. – Eugene Bridger Apr 19 '17 at 02:11
  • Well don't they lose all the points they have if they uninstall? If so what's wrong with giving the bonus again unless they can use those points in some way to abuse your system. – I.B Apr 19 '17 at 03:02
  • Possible duplicate of [Determine if android app is the first time used](http://stackoverflow.com/questions/4636141/determine-if-android-app-is-the-first-time-used) – Gary99 Apr 19 '17 at 03:23
  • when they uninstall the app all the progress they did will get deleted and then when they install the app again they will start from zero and they will get the bonus as if it is the first time they use the app and this is not a problem since they are only reseting the game and not abusing the coins to get more currency – Mohammad Haidar Apr 19 '17 at 08:17
  • Player prefs is [a really bad location](https://forum.unity3d.com/threads/how-secure-is-playerprefs.34331/) to store something like this. The playerprefs file is essentially plaintext and easily modified by the user. – Draco18s no longer trusts SE Apr 20 '17 at 16:45
  • Absolutely. I could use encryption to get around this but it still gets deleted when the app in uninstalled. – Eugene Bridger Apr 21 '17 at 02:50

0 Answers0