Android store.restore() does not work. need help.

maybe i am too quick then :slight_smile: [import]uid: 90610 topic_id: 29859 reply_id: 134492[/import]

Everyone,

We were able to reproduce the purchase error issue. What’s happening is that Google Play is logging the following when calling [lua]store.finishTransaction()[/lua] to finish the purchase transaction…
[lua]E/Finsky ( 3022): [1] NotifyingErrorListener.onErrorResponse: Server error on InAppPurchaseInformationRequest: com.android.volley.ServerError
D/Finsky ( 3022): [1] MarketBillingService.sendResponseCode: Sending response RESULT_SERVICE_UNAVAILABLE for request 6804871345800822387 to com.ansca.test.Corona.[/lua]

This used to work, but I suspect something has changed on Google Play’s end and we’ll need to make changes to support. We’ll look into this as soon as possible. This our top priority issue right now.

It would be great if you guys can check your Android log and verify that this same error is happening to you as well. This way we’ll know that this is the only issue that we’re encountering.
[import]uid: 32256 topic_id: 29859 reply_id: 134520[/import]

@Joshua: I really hope you guys can fix that this coming week, since 2 games just wait to have that fixed… and we want to release before christmas :slight_smile: [import]uid: 90610 topic_id: 29859 reply_id: 134282[/import]

Everyone,

After some investigation, I think I’ve found a solution to this problem. I’ve confirmed that Google Play does require us to make some simple code changes to Corona to make this work again. This probably broke recently because Google Play’s in-app purchase system was just updated to version 3 as of this month is now at version 3. We’ll update our in-app purchase system tomorrow and run several tests to make sure nothing breaks as a result of these changes. If all goes well, expect this to be fixed by this Wednesday’s daily build. [import]uid: 32256 topic_id: 29859 reply_id: 134573[/import]

@joshua: this is great news, thanks a lot! [import]uid: 90610 topic_id: 29859 reply_id: 134590[/import]

@Joshua: any update? [import]uid: 90610 topic_id: 29859 reply_id: 134482[/import]

Strange, I didn’t have any problems with the restore process on Android.
One thing to note though, as Joshua mentioned in his post above, is that the “restored” callback is never sent. You’ll always get a “purchased” callback even on a restore.

Some other things off the top of my head:

Restores will only work for managed items. If your in-app items are unmanaged, you can’t use Google’s restore feature.

Also if you’re too quick to cancel the transaction in your merchant account the restore won’t work, and you’ll have to wait a few hours for Google’s system to reset your testing account again.
[import]uid: 70847 topic_id: 29859 reply_id: 134486[/import]

maybe i am too quick then :slight_smile: [import]uid: 90610 topic_id: 29859 reply_id: 134492[/import]

Everyone,

We were able to reproduce the purchase error issue. What’s happening is that Google Play is logging the following when calling [lua]store.finishTransaction()[/lua] to finish the purchase transaction…
[lua]E/Finsky ( 3022): [1] NotifyingErrorListener.onErrorResponse: Server error on InAppPurchaseInformationRequest: com.android.volley.ServerError
D/Finsky ( 3022): [1] MarketBillingService.sendResponseCode: Sending response RESULT_SERVICE_UNAVAILABLE for request 6804871345800822387 to com.ansca.test.Corona.[/lua]

This used to work, but I suspect something has changed on Google Play’s end and we’ll need to make changes to support. We’ll look into this as soon as possible. This our top priority issue right now.

It would be great if you guys can check your Android log and verify that this same error is happening to you as well. This way we’ll know that this is the only issue that we’re encountering.
[import]uid: 32256 topic_id: 29859 reply_id: 134520[/import]

Everyone,

After some investigation, I think I’ve found a solution to this problem. I’ve confirmed that Google Play does require us to make some simple code changes to Corona to make this work again. This probably broke recently because Google Play’s in-app purchase system was just updated to version 3 as of this month is now at version 3. We’ll update our in-app purchase system tomorrow and run several tests to make sure nothing breaks as a result of these changes. If all goes well, expect this to be fixed by this Wednesday’s daily build. [import]uid: 32256 topic_id: 29859 reply_id: 134573[/import]

@joshua: this is great news, thanks a lot! [import]uid: 90610 topic_id: 29859 reply_id: 134590[/import]

Everyone,

The Google Play in-app purchase issue is now fixed as of daily build #984, which is available now. Please give it a go and let us know if it fixes this issue for you too. Thanks! [import]uid: 32256 topic_id: 29859 reply_id: 134893[/import]

Everyone,

The Google Play in-app purchase issue is now fixed as of daily build #984, which is available now. Please give it a go and let us know if it fixes this issue for you too. Thanks! [import]uid: 32256 topic_id: 29859 reply_id: 134893[/import]

Hi,

due to a customer complaints of not being able to confirm a purchase on a second device, I became aware of this recent problem in google IAP. It actually affects anyone who either re-installs an app or downloads it to more than one device.
I’ve re-built one of my apps using build 986 in order to fix this issue, but testing it on my device still returns with an error - invalidClient.
Has anyone been able to see this problem fixed in a recent build?

Also, I don’t think this is related to finishTransaction call, since we only call this method after receiving the notification from google. [import]uid: 118978 topic_id: 29859 reply_id: 135721[/import]

The restore process worked for me even before build 984.

The only problem was that I got double-callbacks. First a “purchased” and then a “failed” callback before 984. This behavior started after Google updated their IAP system.
Starting with 984 I don’t get double callbacks anymore. I only get the “purchased” callback after a successful restore when testing with my test account.

[import]uid: 70847 topic_id: 29859 reply_id: 135725[/import]

Perhaps this is a different issue. I never had a problem with double callbacks, but the restore used to work few months ago. I suspect the change in google IAP did something to mess with the process, since I do not get a new purchase event when trying to re-purchase, only get the fail message. [import]uid: 118978 topic_id: 29859 reply_id: 135728[/import]

Ugh! Something is broken again!
I just tested with 2012.987 and I’m getting multiple callbacks on purchase.

When I purchased I got a “purchased” callback and shortly afterwards a “cancelled” callback this time instead of a “failed” callback last time I had this problem.
When I restore I also seem to get multiple callbacks but it’s not as obvious.

I need to do some more testing later and get the log from logcat to see what’s happening.

There’s definitely something going on again… :frowning: *sigh* [import]uid: 70847 topic_id: 29859 reply_id: 135734[/import]

to keep it short and simple: i am getting charged, and then cancelled event. restore doesnt work.

joshua, *help* [import]uid: 90610 topic_id: 29859 reply_id: 135736[/import]

OK, I’ve added log strings in my callback function that shows the transaction states reported by Corona SDK.
Here’s the output from the logcat when I try a restore:

D/Finsky ( 1486): [3579] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 1486): [3579] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 1486): [3586] PendingNotificationsService.setMarketAlarm: Setting alarm for account=ingemarbergmark@gmail.com, duration=20000  
D/Finsky ( 1486): [1] MarketBillingService.sendResponseCode: Sending response RESULT\_OK for request 6795394091584693651 to com.swipeware.freemium.bigfatgoalie.  
D/Finsky ( 1486): [3579] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 1486): [3579] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/dalvikvm( 1486): GC\_CONCURRENT freed 639K, 9% free 8255K/9048K, paused 3ms+2ms, total 33ms  
I/Corona ( 1594): Corona SDK Transaction state: purchased  
D/Finsky ( 1486): [3579] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 1486): [3579] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 1486): [1] MarketBillingService.sendResponseCode: Sending response RESULT\_OK for request 4802696585570826483 to com.swipeware.freemium.bigfatgoalie.  
I/Corona ( 1594): Corona SDK Transaction state: cancelled  
I/Corona ( 1594): Corona SDK Transaction state: purchased  
D/Finsky ( 1486): [3580] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 1486): [3580] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 1486): [1] MarketBillingService.sendResponseCode: Sending response RESULT\_OK for request 8617219667100939 to com.swipeware.freemium.bigfatgoalie.  
I/Corona ( 1594): Corona SDK Transaction state: cancelled  
I/Corona ( 1594): Corona SDK Transaction state: purchased  
D/Finsky ( 1486): [3579] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 1486): [3603] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
W/InputMethodManagerService( 447): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@425d38f0 attribute=null, token = android.os.BinderProxy@4218b050  

As you can see I’m now getting 5 callbacks!
purchased->cancelled->purchased->cancelled->purchased

The weird thing is the Google’s marketBillingService is only reporting RESULT_OK, although it’s reporting it multiple times which doesn’t look like a good thing…

For a new purchase I’m going to have to wait a few hours until Google resets my account so I can purchase again. [import]uid: 70847 topic_id: 29859 reply_id: 135738[/import]

… and here’s the logcat from when I try to restore after I cancelled the transaction in my Google Merchant account.

D/dalvikvm( 4748): GC\_CONCURRENT freed 5633K, 57% free 8586K/19796K, paused 3ms+5ms, total 34ms  
D/Finsky ( 4695): [3725] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 4695): [3725] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
I/ElegantRequestDirector( 4695): I/O exception (org.apache.http.NoHttpResponseException) caught when processing request: The target server failed to respond  
I/ElegantRequestDirector( 4695): Retrying request  
D/Finsky ( 4695): [3704] PendingNotificationsService.setMarketAlarm: Setting alarm for account=ingemarbergmark@gmail.com, duration=20000  
D/Finsky ( 4695): [1] MarketBillingService.sendResponseCode: Sending response RESULT\_OK for request 774752125873536508 to com.swipeware.freemium.bigfatgoalie.  
D/Finsky ( 4695): [3696] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 4695): [3696] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 4695): [3725] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 4695): [3725] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 4695): [1] MarketBillingService.sendResponseCode: Sending response RESULT\_OK for request 3801726047355818079 to com.swipeware.freemium.bigfatgoalie.  
I/Corona ( 4748): Corona SDK Transaction state: cancelled  
I/Corona ( 4748): Corona SDK Transaction state: cancelled  
D/Finsky ( 4695): [3697] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 4695): [3725] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 4695): [1] MarketBillingService.sendResponseCode: Sending response RESULT\_OK for request 4500032159300595469 to com.swipeware.freemium.bigfatgoalie.  
I/Corona ( 4748): Corona SDK Transaction state: cancelled  
I/Corona ( 4748): Corona SDK Transaction state: cancelled  
D/Finsky ( 4695): [3696] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
D/Finsky ( 4695): [3697] MarketBillingService.getPreferredAccount: com.swipeware.freemium.bigfatgoalie: Account determined from library ownership.  
W/InputMethodManagerService( 447): Window already focused, ignoring focus gain of: com.android.internal.view.IInputMethodClient$Stub$Proxy@41f308d0 attribute=null, token = android.os.BinderProxy@4233eb98  

Multiple cancelled callbacks.
Previously no callback was sent if the user tried to restore without a previous purchase.

Still waiting for the Google system to reset so I can purchase again…

I see a pattern here in that the callbacks “cancelled->cancelled” in the case above and “cancelled->purchased” are sent twice after the initial response from Google.
[import]uid: 70847 topic_id: 29859 reply_id: 135742[/import]