Handle Cancelling Of Game Center Authentication With Prime31 Plugin

Handle Cancelling Of Game Center Authentication With Prime31 Plugin

If your Game Center enabled app starts the very first time, you have to decide how to handle those situations when the user don’t want to connect to Game Center. A call to GameCenterBinding.authenticateLocalPlayer () triggers 3 login requests even if the user pressed Cancel. Here is my workaroung for this using a message box first.

After a call to GameCenterBinding.authenticateLocalPlayer () you delegate control to the iOS SDK, that means there is no chance to suppress the subsequent 2 login prompts everytime the app will enter foreground again. This behaviour occurs regardless whether the user has pressed Cancel. So users with no Game Center account will be annoyed by authentication requests.

To work around this I use a message box at the very first start of the app. The user is asked if Game Center should be used or not:

Depending on the answer GameCenterBinding.authenticateLocalPlayer () is either called or not. On the other hand there has to be the possibility to use Game Center later on in case the user denied it before. This is done by an extra button in the local high score list which is used as fallback for non-GC users.

This is neither a perfect solution nor cutting edge technology but the best one I found. Even the guys at Prime31 didn’t have a better solution (s. Handle Cancel Login For Game Center). I use the Etcetera plugin from Prime31 to display a native style message box. Edit AuthenticateLocalPlayer to use an alternative way to ask the user.

GameCenterConnector.cs

Calling Game Center App

I provided a local high score list for those users who don’t use Game Center. There is a button to switch to the Game Center app:

The event handler of this button contains the following code:

GameCenterConnector.SharedInstance.ReenableAutoConnect ();
Application.OpenURL („gamecenter:/“);

This opens the iOS Game Center App and puts RRRunner into the background. When getting to foreground again, GameCenterConnector.OnApplicationPause is called and triggers the connecting process.

 

Comments are closed.

Durch die weitere Nutzung der Webseite stimmen Sie der Verwendung von Cookies zu Mehr
By continuing to use the site, you agree to the use of cookies. More

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.

Close