How to tell which platform / device the user is on?

Agent ArgyleAgent Argyle Member, PRO Posts: 188

Is there an attribute we can use in a rule to tell which platform / device the user is playing on?

For example, if I want to use a link to Google Play for a rate-my-app button in Android and a different link to iTunes for iOS, how would one go about this? I really do not want to have to fork the code for different versions of the same game, as that would make maintenance a nightmare.

Thanks

Comments

  • HopscotchHopscotch Member, PRO Posts: 2,782

    @Agent Argyle , the fork in the code you would need either way. A simple rule to run the one or the other.

    Right now there is no way to tell with 100% certainty which OS the user is on. Attributes are coming in a later version.

    The simplest way is to have a game level attribute which you change according to the build you are producing.

    Lets say game.OS = "iOS", "Google", "Amazon", "Tizen", etc, for whichever platforms you support.

    Then have rules for each:

    Rule: if game.OS = "iOS" then call the corresponding URL.

    Also take note that it is only safe on iOS to call the internal browser.

    When you export a build, change the attribute according to the platform you are building for, repeating for each platform.

  • Agent ArgyleAgent Argyle Member, PRO Posts: 188

    I see, that makes sense. That's not so bad, forking on a per-build basis rather than separate project files per platform. Cool, thanks. I look forward to later version of GS where I can simply poll the device in a rule, but this is a decent workaround for now. Cheers.

  • BlackCloakGSBlackCloakGS Member, PRO Posts: 2,250
    edited June 2015

    We have it in the schedule to add OS (and version), Model , and Language / Country to the device attribute in a build this year. Maybe 0.14 if we have time.

Sign In or Register to comment.