GooglePlay Game Service onLeaderboardScoresLoaded always has empty ScoreBuffer - android

I am using the GooglePlay game service for adding a Leaderboard in my game (actually, several leaderboards). Signing in to GooglePlayGameServices works, as well as submitting a score to a given Leaderboard-id. I checked this using a OnScoreSubmittedListener. The result is ok, the score is there.
When trying to retrieve the top scores for a given id using 'loadTopScores', the OnLeaderboardScoresLoadedListener gets called with STATUS_OK, one entry in the LeaderboardBuffer (I checked this entry, it is the exact same leaderboard-id I previously submitted the score to) and alway zero entries in the LeaderboardScoreBuffer. I could not find a solution to this problem. One thing that seems odd is that in the LeaderboardBuffer entry, the player rank is set to -1. But I couldn't find out what that means.
thanks in advance for any insights on this problem =)

I managed to find the problem myself finally =) It was rather easy. Since the services utilize one's google+ account, you have to set the permissions properly. Under "settings" -> "accounts" -> "google" -> "google+" -> "apps with google sign-in" is an entry for my game. There I had to allow uploading of scores to be public. Once I did that everything works fine for me.

Related

Android In-App Purchase Fails Unless User Clears Play Services cache

Our app has an in-app purchase to upgrade to our "Pro" product, in Google-speak this is a one-time non-consumable product. We have launched this product and are actually generating revenue...so aside from our own testing we know that across the globe users are successfully seeing on our in-app sales page 1) the price of the product, and 2) an enabled "buy now" button (please note these two items both are derived from this BillingManager query:
launch {
val sku = billingManager.querySKU(BillingManager.SKUProPack1)
if (sku != null) {
iapPriceText.text = getString(R.string.settings_pro_upgrade_price, sku.price)
skuDetails = sku
upgradeButton.isEnabled = true
} else {
iapPriceText.text = ""
upgradeButton.isEnabled = false
}
}
I'll point out here: skuDetails collected in the query above is also the source of data needed in the actual Play Store purchase flow...so merely enabling the button would only delay the disappointment. The first indication a user sees that there is a problem is on the sales page: no price and a greyed-out button that is disabled.
We have three confirmed cases where the user has contacted us saying "I'd like to buy but the buy-it button doesn't do anything". We have found an ugly-ish workaround which is to have the user clear the cache of their Google Play Services app (and then reset the device). After they do that, they can get back to the sales page and all is well: the price is displayed and the button is enabled.
I'm thinking the step of clearing the cache is a clue to perhaps something that could/should be done within our app to better serve the customer (and, of course, we hope generates more revenue). It's early days for us in this Pro version but the three confirmed cases would be about 2% of the amount who have gotten through the purchase process...which doesn't sound like a lot, but who knows how many have fruitlessly pounded on the buy-it button and then just walked away.
On this, I'm going to file a ticket with Google and will keep all posted here if that yields anything. AND HERE IT IS:
As promised, here is Google's non-response. The link they provided was nice but it did not include the troubleshooting step that we found that works for us (clearing the Play Services cache). Here is Google's response: Hi,
Thanks for your patience.
I'm sorry to hear that some of your users are having a issue making a purchase within your app. Please note after looking into your issue, it looks like the issue is being caused by user end issues. As not all of your users are having the same issue, it would not be a issue within the coding. We are aware that cache and connectivity can cause issues within apps; and we have made a user help article to help guide users on how to fix these issues: https://support.google.com/googleplay/answer/1050566?hl=en
If you begin seeing more users with this issue, you can use log reporting to help determine the issue, you can use the Android logging system which provides a mechanism for collecting and viewing system debug output.
To extract the logs you will need to use "logcat" command as an adb command or directly in a shell prompt of your emulator or connected device:
adb logcat -v time > applog.txt
If you have any other questions about the Play Console, please let me know and I will be happy to assist you further.
Have a great day.
Regards,
Sabrina.
Google Play Developer Support.

Turnbased matches disappear after loading for the first time

I'm developing a game for Android using the Google Play Services for creating a turnbased match.
At first everything was fine I load the turnbased matches for the signed in user using
Games.TurnBasedMultiplayer.loadMatchesByStatus(getApiClient(),
new int[]{TurnBasedMatch.MATCH_TURN_STATUS_MY_TURN,
TurnBasedMatch.MATCH_TURN_STATUS_THEIR_TURN,
TurnBasedMatch.MATCH_TURN_STATUS_INVITED,
TurnBasedMatch.MATCH_TURN_STATUS_COMPLETE})
.setResultCallback(this);
It always loaded all matches that are any of the given states. But since last weekend the callback is called but there are no matches, as I'm not participating in any match (Status response is OK). I deleted the cache of Google Play Services on my phone and rebooted the device. At that moment all the matches were shown again until the next time I opened the app. Again all matches were missing.
Once I start a new match the match keeps showing up with the above method (refreshing the list) until I close the app. At the next launch that match is also gone.
I have to say the game is not published yet but in a test phase on the Google Play Developer Console. I found the same issue on an emulator. It ran fine for days but suddenly got the same problem as my real device (with a later build so it is not that a single change of code causes this).
Did anyone else notice this behaviour or has an idea on how to resolve it?
Might it be related to having multiple apps connected to one game? I had two apps signed with debug certificates connected and this afternoon added one for a signed apk. When I used the signed apk it worked again until I deployed a new test app (debug signed). After switching back to the signed apk the bug is still around.
As nobody seems to know the answer let me rephrase the question. Should I cache TurnBasedMatches myself on the device? I just deleted the play services cache again and reopened my app. Result? A list of hundreds of games (since I have to start a new game every time while testing...)
My code to handle the loadMatchesResult
#Override
public void onResult(TurnBasedMultiplayer.LoadMatchesResult loadMatchesResult)
{
showToast("GotMatches status: " + loadMatchesResult.getStatus().getStatusCode());
//add matches to listview (only caching matchId, no references to turnbasedmatch)
loadMatchesResult.getMatches().getMyTurnMatches().close();
loadMatchesResult.getMatches().getInvitations().close();
loadMatchesResult.getMatches().getTheirTurnMatches().close();
loadMatchesResult.getMatches().getCompletedMatches().close();
loadMatchesResult.release();
}
Found another interest point.. it starts to look like the issue occurs when deploying a new apk to the device... Once I deploy a new apk (either by install alpha version from google play or directly debug version from Android Studio) the matches are gone. When I don't change the apk I can reboot my phone/close the app and it works fine...
Issue also occurs if I update the app through the play store... There should be more people having this problem!
Gotten from https://developer.android.com/reference/com/google/android/gms/common/api/PendingResult.html#setResultCallback(com.google.android.gms.common.api.ResultCallback)
After the result has been retrieved using await() or delivered to the result callback, it is an error to attempt to retrieve the result again. It is the responsibility of the caller or callback receiver to release any resources associated with the returned result. Some result types may implement Releasable, in which case release() should be used to free the associated resources.
After you retrieve the result, an error is given when you try to get the results again, until you free the resources associated with the returned result, which is why clearing the cache works to make them visible again. You need to either access the device's cache and display results from there as well, or clear the associated resources (within the program) whenever you want to access the results again.
I had the same problem until I found "Saved Games" in my Developer Console:
Go to Game Services -> Game Details -> Saved Games
Set the item to "On"
This should solve your issue.

Android IAB: "Error refreshing inventory (querying prices of items)" Developer Error

I've been setting up Android in app billing v3, using the IABHelper class, and following the example code provided by Google. I have it mostly working all the way through purchase (with signed apk and real credit card charge).
However, in the course of testing today I started to get a new error in my QueryInventoryFinishedListener from the queryInventoryAsync() method:
IABResult message: "Error refreshing inventory (querying prices of items)"
IABResult response: 5:Developer Error
Weird thing #1 is that this occurs after the onIabSetupFinished() callback returns (with the customary "Hooray" message). Weird thing #2 is that I can subsequently & successfully process an in app purchase (using the launchPurchaseFlow() method).
I found a patch here that addresses the same symptoms I'm experiencing, but it didn't work for me.
I've tried using different devices, using different gmail accounts, and building a new product from scratch. I even getting the error on earlier versions of my app that ran correctly (what?!).
My question is: Why can't I query the product inventory, even after IABHelper has confirmed the set up was successful? What could be causing this error, and how can I fix it?
Thank you for any insight.
UPDATE
I was able to get the inventory query transactions to work again by ditching the account I was testing with, and switching to a new account. No code change.
My tentative conclusion is that something got corrupted in the user account I was using (?). During testing, I had hit it pretty hard with a lot of purchases of different in-app products -- but I still need to find out what happened, and make sure this doesn't happen to any of my users.
Please let me know if you have any experience with this. Thanks!
We had the same problem in one of our apps under test mode. Later, we figured out that, we had to clear the Cache of the Google Play Store app.
So you can try this -
Go your device's Settings menu.
Go to Applications (may also be labeled Application Manager).
Tab over to All Applications.
Search for and open the Google Play Store app. Tap on it, application settings will show
Tap on Clear Data and Clear Cache.
Now go back to your app and try to load inventory. It solved our problem.
I found by trial and error that if you query more than 20 items at once, it will fail with this error.
I submitted a patch for IabHelper.java that splits the list of SKUs into packets of 20 items each and does the query.
You can grab it there: https://code.google.com/p/marketbilling/issues/detail?id=123
I have the same issue with this log :
"InAppBillingManager.getSkuDetails: Input Error: skusBundle array associated with key ITEM_ID_LIST cannot contain more than 20 items."
this note had mentioned in IInAppBillingService.aidl file, see the documentation of the method getSkuDetails(..) .
So you should make the same process for each 20 items every time
I face same error but my issue is Date Time change
Go to setting and check your date time is accurate

In app purchase displays message "you already own this item." in android

I am trying to implement in-app. In android, in-app is working perfectly.But, when I remove the app from device and reinstall it, then after if I try to purchase, it displays this message (product is Managed and in-app API Version 2)
and in log, I have an error RESULT_DEVELOPER_ERROR , then I googled and I found the Version 3 has more number of response codes like BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED
So if product is already purchased, the response must be like BILLING_RESPONSE_RESULT_ITEM_ALREADY_OWNED and this is not possible in Version 2.
Then what should I do ? Do I need to implement Version 3 ?
if you want force to buy product by every time then product should be Unmanaged.
Products can be of 3 types
1) Managed
2) Unmanaged
3) Subcription
Managed means google it self keep record. so by using same email id user not have to paid its charge e.g. remove ads
Unmanaged means user have to buy every time and will be a charged. e.g. Pocker chips
This 2 example i have read on developer site..
and refer http://developer.android.com/google/play/billing/billing_admin.html
Have you looked into RESTORE_TRANSACTIONS?
I had pretty much the same problem you describe above. My code is, for the most part, taken from the Market Billing Sample Application.
I added a RESTORE button to my purchase activity which calls the BillingService.restoreTransactions routine.
If you search for RESTORE_TRANSACTIONS within this page: https://developer.android.com/google/play/billing/v2/api.html, you'll find that calling that routine re-triggers the PURCHASE_STATE_CHANGED broadcast.
Which, in my code, triggered the onPurchaseStateChange routine and it worked the same way it would on the initial purchase with the PurchaseState was set to PURCHASED.
I ended up with calling BillingService.restoreTransactions() after catching RESULT_DEVELOPER_ERROR. Looks odd, but works fine.

Android In app Billing Item ID

Long things short: If im testing my In-App-Billing apk in the market i always receive "RequestPurchase: RESULT_ITEM_UNAVAILABLE"
Im feeling like a complete idiot atm and ran out of ideas how to fix it.
i call mBillingService.requestPurchase("itemxx", ""), wich works fine with static test.purchased.
But as soon as i upload the signed apk as a draft to the android market it doesnt manage to find my predefined item. Mybe the proper Question at this point is: "How does the ID of the Item in the Market has to be "named" relating to the id you made up in your application.
Can anyone provide me with a hint on what else i can try or look up?
APP: itemxx -> Market: itemxx
APP: itemxx -> Market: package.name.itemxx
APP: package.name.itemxx -> Market: package.name.itemxx
APP: package.name.itemxx -> Market: itemxx
I solved the Problem for me. I use the Sample Code from this resource:
http://www.anddev.org/advanced-tutorials-f21/simple-inapp-billing-payment-t52060.html, thanks for that Mr. #Blundell.
Besides changing the Package-Name to get it up and running it turned out that the ID in the app and in the Market has just to be the same, simple as that.
So i call BillingHelper.requestPurchase(mContext, "item.hacke");
and create an Item for the Application in Android market with the ID item.hacke.
Take care of the following Steps:
Enter the Correct Public Key
Use a different gmail account for your tests than the publisher account and enter the mail address as Test-Account right below the PublicKey
Make sure the item in the market is published. Only the Item not the App.
good luck :D

Categories

Resources