How do I detect a first time startup of an app?

  • Me and a friend are working on a mobile app, and we'd like to give the user an amazing one-time deal, and play a tutorial at the start of the app. The thing is, we want it to only appear at the first launch of the app, not the second, or third, etc...

    (I have tried LocalStorage by checking for the item "FirstTimeStartup" after the logo animation, and from there go to the deal layout or the regular layout depending on whether the "FirstTimeStartup" value was found. I couldn't get that to work.)

    Is there a much easier way to do something like this? I feel like there is a much simpler way that went straight over my head.

  • I haven't done this with construct, however on other platforms it can be done by storing a file.

    When you're app runs the first time, you can check for a file (eg: firstrun.txt). If it doesn't find it, then it's the first time that it was run since installed. As soon as it has been run, you write the file out with 1 byte (Eg: 'Y').

    The next time the app runs, when you check for the file, and it will exist, so you skip the tutorial bit.

    This way, in options, if you want you can give the option 're-enable tutorial' and just delete the file so the tutorial runs next time.

  • Ah, thanks! Would I use LocalStorage for that?

  • Local Storage is the best option. If you post a screenshot of your code, we could tell you why it doesn't work.

  • Local Storage is the best option. If you post a screenshot of your code, we could tell you why it doesn't work.

    I am using "Get Item" at the end of the logo's animation, triggering one or the other of these. But it always takes you to "MainMenu".

  • Are you removing "FirstTimeStartup" item from Local Storage before every test?

    Also make sure that the "Get Item" action is only triggered once.

    I suggest you add debug output (Browser -> Log "some text") to each event and see in browser console what's going on.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Are you removing "FirstTimeStartup" item from Local Storage before every test?

    Also make sure that the "Get Item" action is only triggered once.

    I suggest you add debug output (Browser -> Log "some text") to each event and see in browser console what's going on.

    Yes, I'm removing "FirstTimeStartup". Get Item is only being triggered once.

    UPDATE Using the debugger, I realize that construct 2 is not even creating the item in the first place, so I don't know why it would take me to the main menu.(that's supposed to happen when "FirstTimeStartup" exists) I'm so confused right now

    EDIT 2 I just realized how stupid I am... I realized "On item get" does not let "Check item exists" trigger it... I changed "On item get" to "On item exists" and it works perfectly. I apologize for wasting your time!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)