Hey, I'm aware of this issue #715
However it doesn't solve mine, I'm looking for a way to determine if this app https://play.google.com/store/apps/details?id=com.google.android.play.games is installed.
Trying the script mentionned it always reported true even when I uninstalled the Google Play Games... :/
I would like to prevent the big popup when starting the game if the app isn't installed.
FIgured it out:
``` c#
AndroidJavaClass up = new AndroidJavaClass("com.unity3d.player.UnityPlayer");
AndroidJavaObject ca = up.GetStatic
AndroidJavaObject packageManager = ca.Call
AndroidJavaObject launchIntent = null;
//if the app is installed, no errors. Else, doesn't get past next line
try {
launchIntent = packageManager.Call
//
// ca.Call("startActivity",launchIntent);
} catch (Exception ex) {
//Debug.Log("exception"+ex.Message);
}
Debug.Log("Is Play Games installed: " + launchIntent != null);
```
Would be nice to have it as a method directly in the package!
Nice suggestion. I think this check is done during authentication, do you want to do it outside that?
Feel free to submit a pull request to add it to the plugin.
I'm have issues with my users who don't have Play Games installed (see https://github.com/playgameservices/play-games-plugin-for-unity/issues/1368) so I don't think a check is done during authentication, but I could be wrong.
I don't see any checks prior to creating the plugin natively at least, https://github.com/playgameservices/play-games-plugin-for-unity/blob/master/source/PluginDev/Assets/GooglePlayGames/Platforms/PlayGamesClientFactory.cs#L35
Regardless it would be cool to have C# exposed method to check for Google Play games availability at runtime.
This won't stop the popup in all cases. There are two components to Play Game services. The first is checked with the one outlined in #715. This is checking for Google Play Services, and will return false for Android devices that don't use the Google Play Store to distribute apps. As you pointed this usually returns true, or maybe that it needs to be updated to meet the minimum version requirements from the client library.
The second component is that the Play Games App implements some of the game services APIs on behalf of play services (not exactly a DLL, but similar). This method you are adding will check that the app is installed, but does not check for the correct version. As a result, your players could still get a big pop up indicating that Play Games needs to be updated.
Can you expand on what you want to guard against? It seems like if your game uses Play Game Services, and it is available on the device, why not have the player do the one time update to get the correct version of the app? For a large proportion of the population, this happens automatically if they have auto-update on for their apps.
My personal use case was the first scenario you outlined. I want to avoid authenticating to Google Play Services and also log to may backend when someone is running my game without Google Play Services on their phone. Before I implemented the check I was seeing a lot of crashes from users, this helps avoid that.
I think the second scenario is acceptable. Google Play Services are supported, and hence the method is giving the right information, but they may need to be updated. But you have a better handle on what is going to work for a larger user base.
I started a PR based on your comment:
Nice suggestion. I think this check is done during authentication, do you want to do it outside that?
Feel free to submit a pull request to add it to the plugin.
This is integrated into version 0.9.36
For anyone who ends up here, to check if Play Games is installed check this property:
GooglePlayGames.OurUtils.PlatformUtils.Supported
Good job bro :D
Most helpful comment
For anyone who ends up here, to check if Play Games is installed check this property:
GooglePlayGames.OurUtils.PlatformUtils.Supported