Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Detecting whether users have previously ever installed the app

Discussion in 'iOS and tvOS' started by rjenman, Mar 18, 2021.

  1. rjenman

    rjenman

    Joined:
    Sep 30, 2020
    Posts:
    4
    Hi
    I am making an app with a large "Welcome bonus" that will last the player many weeks, and then after that you must rely on small "daily bonus" that will only last a couple of hours of gameplay, or pay for further bonuses. The user will be able to get around the need to pay or wait for the "daily bonus" by uninstalling and then reinstalling the app in order to get the "welcome bonus" again.
    Is there a way to detect if users have previously ever installed the app? The only thing I can think of is forcing the users to "log in" to play the game at all, or only allowing the "welcome bonus" if you log in with your facebook details or confirmed by email. But I perceive this would annoy many people who will simply drop the game when asked for personal information straight up or if they are lacking in common sense or patience, simply uninstall the app without ever playing it due to the request.
     
  2. kaharoth

    kaharoth

    Joined:
    Feb 13, 2015
    Posts:
    21
    Hi Rjenman,
    How do you save the data about the coins balance? I suppose using PlayerPrefs or with a file.
    I think you can use the same methodology and store an integer telling you how many welcome bonuses has the user received.
    For example you can do something like this:
    Code (CSharp):
    1. private const string kWelcomeBonus = "kWelcomeBonus";
    2. if (PlayerPrefs.HasKey(kWelcomeBonus)) {
    3.   int x = PlayerPrefs.GetInt(kWelcomeBonus);
    4.   if (x == 1) {
    5.      //The user already received 1 welcome bonus
    6.   }
    7. }
    8. else {
    9.    // Give your welcome bonus
    10.    PlayerPrefs.SetInt(kWelcomeBonus, 1);
    11. }
     
  3. Petras-Unity

    Petras-Unity

    Unity Technologies

    Joined:
    Oct 7, 2020
    Posts:
    24
    On iOS all local data is deleted upon deleting an app (with an exception of keychain), including PlayerPrefs. You have couple options:
    1) Write custom plugin that writes a flag to Keychain or store preferences in iCloud.
    2) Have user identified and validate the flag in your own remote server. For identifying user I suggest using Game Center as it's the quickest method and has integrations inside unity.
     
  4. Voxel-Busters

    Voxel-Busters

    Joined:
    Feb 25, 2015
    Posts:
    1,832
    As suggested, one easy option is to make use of Cloud Save (iCloud/Saved games) and you need to inform the user to have it enabled. Or drive him to enable it by saying he gets part of the bonus if he enables icloud or your own login system.