Trying to integrate google play games leaderboard in an android application.
Google API client get connected successfully. I am getting result code as -1 which is nothing but RESULT_OK.
But when I call google leaderboard api using leaderboard intent in my on activity result I get 10001 which stands for inconsistent state which is RESULT_RECONNECT_REQUIRED. Even though before calling the intent i am checking is the google api client is connected or not. Which returns true each and every time.
Not able to understand what might be causing this issue.
hope this may help you in solving your problem:
https://code.tutsplus.com/tutorials/google-play-game-services-leaderboards--cms-20700
These links will help u in, Overview : https://code.tutsplus.com/tutorials/google-play-game-services-achievements--cms-20591. Integration :https://code.tutsplus.com/tutorials/integrating-google-play-services-on-android--cms-19828. If you are not satisfied refer this link,https://coronalabs.com/blog/2013/06/25/tutorial-introducing-google-play-game-services/
According to the documentation, RESULT_RECONNECT_REQUIRED is sent back to the calling Activity when a reconnect is required.
The GoogleApiClient is in an inconsistent state and must reconnect to the service to resolve the issue. Further calls to the service using the current connection are unlikely to succeed.
To handle it call googleApiClient.reconnect() and onConnected() will be called when the client is connected again.
The reason you might get that code is because app is not linked. So on play games developer console linked my application and it started to work.
Related
I have implemented App Check for my application , I have registered Sha256s,activated appcheck in console,initialized it buy it doesnt work with play Integrity !! I always get " Detected invalid AppCheck token. Reconnecting (0 attempts remaining) Firebase Database connection was forcefully killed by the server. Will not attempt reconnect. Reason: Invalid appcheck token" ,
But with safetynet it works well however as we know it will be deprecated
My code:
initialize app check
as you can see if I change play integrity by safetynet it works well ,i can access to my db,but safe net will stop working in about one year
I have already read all posts related to this problem on this web ,but i havent been able to find a solution Thanks in advance
So we want to support in-app billing via Google's billing API and via AliPay for China. I've written a method that should return either a GooglePlay or an AliPay billing client (whichever is available). I need a way to determine whether Google's billing service is available to the user so I know which client to return.
So far I've come across a few different options and I'm unsure which one is the one I need:
Create a ServiceConnection and check the result of IInAppBillingService.Stub.asInterface(service)
.isBillingSupported(3, context.packageName, "inapp")
Here's the full code: https://gist.github.com/first087/9088162
This is a bit tedious since I need to wait for the service to connect, get the asynchronous result and then return the correct billing manager, but at first glance seems to be exactly what I need.
Use the GoogleApiAvailability class and check the result of isGooglePlayServicesAvailable(context)
This option is a lot cleaner than the 1st one, but I'm unsure whether it returns what I need and also requires me to add the com.google.android.gms:play-services-base library to my project.
Check if the GooglePlay app is installed on the device.
This is the most unreliable option (I think), because you can manually install the app, even though it's not been pre-installed by the manufacturer, and then you might not be able to make purchases since you're in China and they don't allow that.
Has anybody had similar experience? How do I correctly determine whether the user can make purchases via the PlayStore?
So after testing the methods in China, with a phone that did and didn't have a the PlayStore app installed, here's what we found:
With PlayStore app installed and without VPN
GoogleApiAvailability.isGooglePlayServicesAvailable() returns code 2 - ConnectionResult.SERVICE_VERSION_UPDATE_REQUIRED
IInAppBillingService.isBillingSupported() returns code 3 - BillingResponse.BILLING_UNAVAILABLE
Without PlayStore app installed and without VPN
GoogleApiAvailability.isGooglePlayServicesAvailable() returns code 9 - ConnectionResult.SERVICE_INVALID
IInAppBillingService.isBillingSupported() returns code 3 - BillingResponse.BILLING_UNAVAILABLE
With PlayStore app installed and with VPN
GoogleApiAvailability.isGooglePlayServicesAvailable() returns code 0 - ConnectionResult.SUCCESS
IInAppBillingService.isBillingSupported() returns code 3 - BillingResponse.BILLING_UNAVAILABLE
Conclusion: The safest way to determine whether billing is actually available is via the isBillingSupported() method. If you don't want to use it via the "hacky" way shown in option 1 of the question, you can just instantiate a new BillingClient and wait for the callback of its startConnection() method.
Here's a gist of the coroutine I wrote which gives you one of the two implementations of a BillingManager depending on whether in-app billing via the PlayStore is available.
I have upgraded to Firebase Android libraries v11.4.2 to try out Firestore on my Android app. However, when I try to use FirebaseAuth to login with signInWithEmailAndPassword(), my app just hangs. I have confirmed with the debugger that the signInWithEmailAndPassword() call is made, but the callback is never called. I have also reverted back to v11.0.2 with no other code changes and it works as expected.
Has anyone else had this problem and how did you fix it?
Thanx in advance.
I figured this out. The emulator had the wrong version of Play services. I followed the directions in the first answer for this question: Google Play services out of date. Requires 11011000 but found 10289574 and it worked.
I am implementing realtime multiplayer game using Google Play Game Services. I am experiencing weird issues. My Google Account I am using for login gets randomly "banned" and is unable to communicate with Google servers for approx. 30-40 minutes. After that, everything is working well again. In the meantime I can use other accounts.
The response error I get from LogCat is this:
Unexpected response code 403 for
https://www.googleapis.com/games/v1/players/102515671693140579145
Access Not Configured
Unable to sign in - application does not have a registered client ID
This message is very misleading since everything is set up well. It works most of the time.
I have tried publishing the game and using test as well as non-test accounts. All of them get banned at some point.
Thanks for any help !
This behavior will occur if:
Current user is connected into any room and:
the app is restarted such that it tries to login to Google Services without having gone through the disconnect portion as required by Google Play Services.
I found this happened to me quite regularly (unfortunately for me) as I was figuring out how to pass messages between my Android code and LibGDX code side (my app would just Lock up due to synchronization issues). I also setup some test accounts that I could "cycle" through to avoid being completely locked out of logging in. However, I found out that if I used Task Manager to Kill the process before restarting the app, 90+ percent of the time, I could continue to use the same account.
If you are updating your code, and load to the device while you are in a Room, this will also earn you the server wrath for approximately 30 minutes for that account.
In short, to keep your account viable:
1) ensure you LeaveRoom prior to updating your code (I have found logging out of PS is not required)
2) If your app locks up... Killing the process via Task Manager (I use Samsung devices) will most likely let your account continue (you can see in the logcat where it calls the disconnect when you do that) when you start up the app again.
This question is the same as this Google+ Platform for Android - getCurrentPerson but i didn't find the solution here.
Here's the problem:
plusClient.getCurrentPerson() always returns null from onSignedIn(PlusClient plusClient) function
I used the PlusSampleActivity -> SignInActivity from Google Play Services.
Is this a bug, or anyone here knows how to fix this?
Have you setup a client ID for your application in the API console (https://code.google.com/apis/console)? When your app connects, its key fingerprint and packagename are used to look up a project from the console and check whether you have the Google+ API enabled, and enough quota to handle the request. If its not found, it looks like you have 0 quota so the request fails, which will give you null.
You can see the steps to follow here: https://developers.google.com/+/mobile/android/getting-started#step_1_enable_the_google_api
As was answered by Ian, you must setup your app hash key in the API console. But beware that after performing this setup it may take some time (sometimes few hours) before you can use it, so be patient.