libgdx / gdx-pay

A libGDX cross-platform API for InApp purchasing.
Apache License 2.0
225 stars 82 forks source link

Failed to invoke onActivityResult , 1.6.2 + gdx pay 4.0 & 5.0-SNAPSHOT Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.sec.android.iap.service.iapService } #44

Closed tajny closed 9 years ago

tajny commented 9 years ago

this happens on Android 5.0 , Samsung S5, Google Play 5.6.8

openiab-0.9.8.6

but on different test devices it works as expected

what the hell ? ;)

06-10 12:34:58.293: D/GdxPay/IAP(23868): Failed to invoke onActivityResult(...) on purchase manager.
06-10 12:34:58.293: D/GdxPay/IAP(23868): java.lang.reflect.InvocationTargetException
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at java.lang.reflect.Method.invoke(Native Method)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at java.lang.reflect.Method.invoke(Method.java:372)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at com.badlogic.gdx.pay.android.IAP.onActivityResult(IAP.java:99)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at com.badlogic.gdx.backends.android.AndroidApplication.onActivityResult(AndroidApplication.java:473)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.app.Activity.dispatchActivityResult(Activity.java:6475)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.app.ActivityThread.deliverResults(ActivityThread.java:3970)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.app.ActivityThread.handleSendResult(ActivityThread.java:4017)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.app.ActivityThread.access$1400(ActivityThread.java:172)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1471)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.os.Handler.dispatchMessage(Handler.java:102)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.os.Looper.loop(Looper.java:145)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.app.ActivityThread.main(ActivityThread.java:5832)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at java.lang.reflect.Method.invoke(Native Method)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at java.lang.reflect.Method.invoke(Method.java:372)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1399)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1194)
06-10 12:34:58.293: D/GdxPay/IAP(23868): Caused by: java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.sec.android.iap.service.iapService }
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1982)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:2090)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.app.ContextImpl.bindService(ContextImpl.java:2068)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at android.content.ContextWrapper.bindService(ContextWrapper.java:559)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at org.onepf.oms.appstore.SamsungAppsBillingService.bindIapService(SamsungAppsBillingService.java:383)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at org.onepf.oms.appstore.SamsungAppsBillingService.handleActivityResult(SamsungAppsBillingService.java:268)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at org.onepf.oms.OpenIabHelper.handleActivityResult(OpenIabHelper.java:1341)
06-10 12:34:58.293: D/GdxPay/IAP(23868):    at com.badlogic.gdx.pay.android.openiab.PurchaseManagerAndroidOpenIAB.onActivityResult(PurchaseManagerAndroidOpenIAB.java:437)
noblemaster commented 9 years ago

Not sure if this is related to gdx-pay directly. I think something with the OpenIAB/Samsung binding might not work as intented:

http://stackoverflow.com/questions/24480069/google-in-app-billing-illegalargumentexception-service-intent-must-be-explicit

Does any of the solutions proposed there fix your problem?

tajny commented 9 years ago

Figured this out, it seems that this issue shows when there are two inapp services installed on device and openiab tries to guess the right one.

from https://github.com/onepf/OpenIAB/releases/tag/0.9.8

new 'store search strategy' options: installer(only the app installer can be a billing provider), installer then best fit (if the app installer is null or was uninstalled from the device the next suitable billing provider will be chosen), best fit (the choice is based on an options set) Amazon IAP 2.0 support Skubit store support Note: to emulate installation from a certain store, you need to install your app using adb install -i storepackage /path/to/yourapk

when installed from market ( not by adb ) everything is working as expected.