Search Unity

How to stop Google from asking to Install Google Play Games more than once.

Discussion in 'Android' started by esteban16108, Jul 14, 2018.

  1. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    159
    Hi,

    So, my game uses Google Play Services but I only initialize it once on the Pre Loader and again when they try to open the leaderboards.

    My question is, when the game starts and if Google Play Games is not installed it will ask to install, if the user cancels at that time it will continue asking several times even when I'm not trying to initialize it anymore.

    So how to make it stop if the user cancels?

    Thanks.
     
  2. JoathrentStudios

    JoathrentStudios

    Joined:
    Jan 27, 2018
    Posts:
    23
    Any time you do a google call it is going to try to authenticate if it has not yet done so. You need to track that the authentication failed in the call back then save the state (if user is logged in or something in playerprefs). Then wrap all calls to any google API's such as calls to leader boards and achievements with that variable state.
     
  3. esteban16108

    esteban16108

    Joined:
    Jan 23, 2014
    Posts:
    159
    My fault in here.

    I was calling the initialization method on the Start of the same class that manages the Social things and it's a singleton, so every time some other class accessed it, it was trying to initialize it again and again.

    Now I have only 1 entry point where I call Initialize and then in other places I check if it's initialized before doing any other action.

    Thanks.