Closed tzvetkovg closed 8 years ago
We should fix that & catch the error internally! If have time, please submit a pull-request. Otherwise, I'll try to take care of it later.
well, basically in the method
public void handleRestoreError (Throwable e) {
throw new GdxRuntimeException(e);
}
I've just commented out the line throw new GdxRuntimeException(e); and now it does throw the error but it doesn't kick you out of the application which works ok for me. Please let me know whether that might have some other consequences or it's ok?
Hold on! My bad: I didn't read the stacktrace in too much detail. As you posted, the error/crash actually happens in your code (unless I am reading it wrong):
com.saveggs.game.GameClass$1.handleRestoreError(GameClass.java:213)
You said you commented out the line with the RuntimeException:
public void handleRestoreError (Throwable e) { throw new GdxRuntimeException(e); }
Commenting out the runtime exception in your code is fine. However, you should create a popup for the user instead letting him/her know of the error. If you are commenting out the exception, that's fine internally. I would probably show an alert box something like: "Error refreshing inventory (querying prices of items)." (i.e. the original error message).
Also, if the restore was successful, I would popup an alert box letting the user know that his/her purchases were successfully restored.
yeah, I see..thank you. I think this error will generally occur if you don;t have internet connection but you call purchaseRestore(). The throw new GdxRuntimeException(e); is making the application to completely stop working so it might be a good idea to be fixed in the future. Apart from the that I am quite happy with gdx-pay, keep up the good work!
Hi,
I've got the following issue. I am calling purchaseRestore() in my splashscreen only when I have internet connection on the device. First, I check whether the phone has internet connection (mobile enabled or wifi). However, in my case the data allowance has been stopped by my provider so when I check for internet it says "internetEnabled" (although it's limited by the provider) and goes into the purchaseRestore() method. This on the other hand throws the following error
12-24 15:51:32.655: D/AndroidRuntime(14445): Shutting down VM 12-24 15:51:32.657: E/AndroidRuntime(14445): FATAL EXCEPTION: main java.lang.RuntimeException: IabResult: 6, Error refreshing inventory (querying prices of items). (response: 6:Error) 12-24 15:51:32.657: E/AndroidRuntime(14445): at com.saveggs.game.GameClass$1.handleRestoreError(GameClass.java:213) 12-24 15:51:32.657: E/AndroidRuntime(14445): at com.badlogic.gdx.pay.android.openiab.PurchaseManagerAndroidOpenIAB$3.onQueryInventoryFinished(PurchaseManagerAndroidOpenIAB.java:402) 12-24 15:51:32.657: E/AndroidRuntime(14445): at org.onepf.oms.OpenIabHelper$17$1.run(OpenIabHelper.java:1463) 12-24 15:51:32.657: E/AndroidRuntime(14445): at android.os.Handler.handleCallback(Handler.java:739) 12-24 15:51:32.657: E/AndroidRuntime(14445): at android.os.Handler.dispatchMessage(Handler.java:95) 12-24 15:51:32.657: E/AndroidRuntime(14445): at android.os.Looper.loop(Looper.java:211) 12-24 15:51:32.657: E/AndroidRuntime(14445): at android.app.ActivityThread.main(ActivityThread.java:5321) 12-24 15:51:32.657: E/AndroidRuntime(14445): at java.lang.reflect.Method.invoke(Native Method) 12-24 15:51:32.657: E/AndroidRuntime(14445): at java.lang.reflect.Method.invoke(Method.java:372) 12-24 15:51:32.657: E/AndroidRuntime(14445): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1016) 12-24 15:51:32.657: E/AndroidRuntime(14445): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:811) 12-24 15:51:32.657: E/AndroidRuntime(14445): Caused by: java.lang.RuntimeException: IabResult: 6, Error refreshing inventory (querying prices of items). (response: 6:Error) 12-24 15:51:32.657: E/AndroidRuntime(14445): ... 10 more
and I am kicked out of the application. This is because there's no internet connection but I am still calling purchaseRestore(). Is there any way to catch that error and continue the game even though there's no internet connection? Any advice appreciated