I am making user login into google play service by a simple button click
and in function i am calling the function they explain in their git repository.
this is my code for authentication.
void Start () {
PlayGamesClientConfiguration config = new PlayGamesClientConfiguration.Builder()
// enables saving game progress.
.EnableSavedGames()
.Build();
PlayGamesPlatform.InitializeInstance(config);
// recommended for debugging:
PlayGamesPlatform.DebugLogEnabled = true;
// Activate the Google Play Games platform
PlayGamesPlatform.Activate();
}
i also have Saved Game enable in my google developer console.
but when I open the game in my physical device I got the popup of Play service but after that nothing happens Authentication failed.
this the logcat i am receiving on authentication failure.
07-21 15:27:35.769 10917-10917/com.logicon.testgame V/GamesNativeSDK: Play Games callback indicates connection failure.
07-21 15:27:35.770 10917-11467/com.logicon.testgame I/GamesNativeSDK: UI interaction required to connect to Google Play.
07-21 15:27:38.231 10917-10917/com.logicon.testgame V/GamesNativeSDK: Play Games callback indicates connection failure.
07-21 15:27:38.231 10917-11467/com.logicon.testgame I/GamesNativeSDK: UI interaction required to connect to Google Play.
07-21 15:27:40.707 10917-10917/com.logicon.testgame V/GamesNativeSDK: Play Games callback indicates connection failure.
07-21 15:27:40.707 10917-11467/com.logicon.testgame I/GamesNativeSDK: UI interaction required to connect to Google Play.
07-21 15:27:46.010 10917-10917/com.logicon.testgame V/GamesNativeSDK: Play Games callback indicates connection failure.
07-21 15:27:46.010 10917-11467/com.logicon.testgame I/GamesNativeSDK: UI interaction required to connect to Google Play.
07-21 15:27:46.019 10917-11558/com.logicon.testgame I/Unity: [Play Games Plugin DLL] 07/21/16 15:27:46 +05:00 DEBUG: Starting Auth Transition. Op: SIGN_IN status: ERROR_NOT_AUTHORIZED
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
GooglePlayGames.OurUtils.Logger:d(String) (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\OurUtils\Logger.cs:58)
GooglePlayGames.Native.NativeClient:HandleAuthTransition(AuthOperation, AuthStatus) (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\Platforms\Native\NativeClient.cs:577)
GooglePlayGames.Native.PInvoke.GameServicesBuilder:InternalAuthFinishedCallback(AuthOperation, AuthStatus, IntPtr) (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\Platforms\Native\PInvoke\GameServicesBuilder.cs:78)
(Filename: E Line: 0)
07-21 15:27:46.051 10917-11558/com.logicon.testgame I/Unity: AuthState == Unauthenticated calling auth callbacks with failure
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
GooglePlayGames.Native.NativeClient:HandleAuthTransition(AuthOperation, AuthStatus) (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\Platforms\Native\NativeClient.cs:623)
GooglePlayGames.Native.PInvoke.GameServicesBuilder:InternalAuthFinishedCallback(AuthOperation, AuthStatus, IntPtr) (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\Platforms\Native\PInvoke\GameServicesBuilder.cs:78)
(Filename: E Line: 0)
07-21 15:27:46.079 10917-10952/com.logicon.testgame I/Unity: [Play Games Plugin DLL] 07/21/16 15:27:46 +05:00 DEBUG: Invoking user callback on game thread
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
GooglePlayGames.OurUtils.Logger:d(String) (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\OurUtils\Logger.cs:58)
GooglePlayGames.Native.<InvokeCallbackOnGameThread>c__AnonStorey16`1:<>m__25() (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\Platforms\Native\NativeClient.cs:164)
GooglePlayGames.OurUtils.PlayGamesHelperObject:Update() (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:136)
(Filename: E Line: 0)
07-21 15:27:51.010 10917-11467/com.logicon.testgame W/art: Native thread exiting without having called DetachCurrentThread (maybe it's going to use a pthread_key_create destructor?): Thread[14,tid=11467,Native,Thread*=0x9b918800,peer=0x12f7c0a0,"main_dispatch"]
07-21 15:27:51.010 10917-11467/com.logicon.testgame V/GamesNativeSDK: Detaching from JVM on thread main_dispatch
07-21 15:28:22.902 10917-10917/com.logicon.testgame I/Unity: onPause
07-21 15:28:22.932 10917-10952/com.logicon.testgame I/Unity: [Play Games Plugin DLL] 07/21/16 15:28:22 +05:00 DEBUG: Application is pausing, which disconnects the RTMP client. Leaving room.
UnityEngine.DebugLogHandler:Internal_Log(LogType, String, Object)
UnityEngine.DebugLogHandler:LogFormat(LogType, Object, String, Object[])
UnityEngine.Logger:Log(LogType, Object)
UnityEngine.Debug:Log(Object)
GooglePlayGames.OurUtils.Logger:d(String) (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\OurUtils\Logger.cs:58)
GooglePlayGames.Native.NativeRealtimeMultiplayerClient:HandleAppPausing(Boolean) (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\Platforms\Native\NativeRealtimeMultiplayerClient.cs:123)
GooglePlayGames.OurUtils.PlayGamesHelperObject:OnApplicationPause(Boolean) (at E:\AsadMehmood-Unity\New Unity Project\Assets\GooglePlayGames\OurUtils\PlayGamesHelperObject.cs:162)
(Filename: E Line: 0)
07-21 15:28:22.942 10917-10952/com.logicon.testgame D/Unity: Sensor : Accelerometer ( 1) ; 0.000595 / 0.00s ; MPU6515 Accelerometer / InvenSense
07-21 15:28:22.969 10917-10917/com.logicon.testgame V/GamesNativeSDK: Received Activity Stop Event.
please help me with this
The user needs to be added a tester in the play games developer console also.
@claywilkinson I done that many times remove and add again but this thing never worked.
I end up creating the new game in the console and in Unity as well and till now it's working fine.
I still don't know what was the issue with the previous one.
@asadmehmoodlogicon I'm not even getting that Google Play Games window.
If anyone has the solution, it would be very helpful.
@AlcantaraRW I get that window but after a while it disappear and authentication failed.
for same issue i created the whole new project again and its working. but for the old project I got the same issue but the Google Play Games window showing..
@AlcantaraRW I came up with a solution its strange but working for me
add your email address in tester section of game play service.
and then goto Unity player setting->playersettings then check existing keystore, browse to select keystore enter password and select key choose alias and enter pass word and then close window.
now press CTRL+B to make build on your physical device and its working for me amazingly.
@asadmehmoodlogicon Thanks for the tip, but it's all still the same... :(
@AlcantaraRW try turning on Saved Game in your developer console
having same issue today ..ANybody got solution to it?
@idurvesh
Yes on Game Services Turn on Saved Games
always make build with your keystore and password
add your mobile email id in game service's tester section
Thanks for your quick response..I have Beta release of game so I had not added Testers...Just added it to a console, do I have to rebuild apk ?
Just make sure
Your In Game Services Setting Turn on Saved Games
Yes it is Turn on...I tried it again, the issue still persists....
try it for testing purpose add your email in test section and see if you are able to login
You Must make build with your keystore that you used before
and try it on mobile
I Recommend keep open Android studio with it to check the log and let me know
Was just checking logcat, here is the error I got "You have wrong OAuth2 related configuration, please check. Detailed error : UNREGISTERED_ON_API_CONSOLE"
please try this one and let me know
https://stackoverflow.com/questions/43702781/google-play-games-services-unregistered-on-api-console
and make sure for got all these steps properly and carefully
https://developers.google.com/games/services/console/enabling
@asadmehmoodlogicon In Stackoverflow's answer it mention "now go to google api console. you will find your game there select it . " I am not sure what do he mean by "Google API console" ? Where do I gind it?
I see nothing in that dashboard...Shall I enable "Google Play Game Services" API? How do I add my game there?
forget that I made you totally confused with that stackOverflow thing
Just Make Sure you did everything right according to this
https://developers.google.com/games/services/console/enabling
awesome it worked , I added new app with right SHA1, previously I used default one which Play store provided...BTW now it is directly signing me in even though I have 2 accounts on phone.How do I give pop up to user to choose from which account to log in...
Wow Great
No need for that
Google Game Play Services will do that for you
Just Provide Signout and login Options from Google play games in your game
and if required google auto shows default popup for you
no need to work around here
Awesome, Can't thank you enough for your time and quick responses.
Glad I could help
@asadmehmoodlogicon Quick question, I want to load data when user login to their account, but how to know if a user has already saved data onto cloud or not? is there is a method which says nothing is returned? Say if user do not have anything in cloud then Save from local to Cloud, else retrieve from Cloud to local
I had probably similar problem. What's happens for me is that unity signed the app using "Development" certificate. so what finally helped me (found it on official page)
On Windows, the debug keystore can be found at C:Users
.androiddebug.keystore. On Mac or Linux, the debug keystore is typically located at ~/.android/debug.keystore.
So on MacOS just run
keytool -list -keystore ~/.android/debug.keystoreDefault password isandroid
Copy SHA1 from output
- Open Credentials at GoogleAPI console
- Create new Oauth2.0 client for your app using this SHA1
Most helpful comment
Wow Great
No need for that
Google Game Play Services will do that for you
Just Provide Signout and login Options from Google play games in your game
and if required google auto shows default popup for you
no need to work around here