Bug 44179 - It fails with exception message: Service intent must be explicit: Intent {act=com.android.vending.billing.InAppBillingService.Bind}”
Summary: It fails with exception message: Service intent must be explicit: Intent {act...
Alias: None
Product: Components
Classification: Xamarin
Component: Xamarin Components ()
Version: N/A
Hardware: PC Windows
: --- normal
Target Milestone: ---
Assignee: Bill Holmes
Depends on:
Reported: 2016-09-12 10:33 UTC by Sergey Rabusov
Modified: 2016-12-05 11:38 UTC (History)
5 users (show)

Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.

Please create a new report for Bug 44179 on Developer Community or GitHub if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: Developer Community HTML or GitHub Markdown
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Sergey Rabusov 2016-09-12 10:33:31 UTC
Since Android 5.0 we have a problem with  Xamarin.InAppBilling.


_serviceConnection = new InAppBillingServiceConnection (_activity, publicKey); 

I see that:
_serviceConnection.Service == null 

and after call:
_serviceConnection.Connect (); 

It fails with exception message: Service intent must be explicit: Intent {act=com.android.vending.billing.InAppBillingService.Bind}”

Finally our clients have no access to the Google Play service with our digital content.
Comment 1 Brendan Zagaeski (Xamarin Team, assistant) 2016-09-13 05:06:16 UTC
In case it's helpful as a point of comparison, I recently (on September 7) went through the process of walking through setting up the sample app that's included in the Xamarin.InAppBilling component, creating a test app ID for it on my Play Store account, adding some custom in-app product IDs, and confirming that I was able to complete test-purchases and consumes for my in-app products (I tested on both an LG Android 4.1.2 device and a Motorola Android 6.0 device).

A few few things you might try:

- If you're currently using `Security.Unify()` to split up the publicKey, you could try temporarily switching over to using the raw full string of the publicKey in a test publication to your testing Alpha channel.  (In my tests, I decided to skip the `Security.Unify()` method for simplicity.  I also noticed some reports on the Xamarin forums that hinted that the `Security.Unify()` method might cause issues in some environments.)

If this turns out to be the problem, be sure to report back with that result so the Components team can work on fixing the `Security.Unify()` method for compatibility.  Thanks!

- Make sure you have the Xamarin linker under the Android Build section of the project options set to link only SDK assemblies (and _not_ both SDK and user assemblies).

- As a "control experiment" to see if some other setting might have crept into your particular project that might be causing an issue, you could try temporarily replacing your real app on your Alpha channel with a compiled version of the sample app "InAppBillingTest" that is included with the component.

Support Team
Comment 2 Sergey Rabusov 2016-09-26 10:51:29 UTC
Ok, Brendan,

I set the Android Build section of the project options set to link only SDK assemblies... and after
 _serviceConnection = new InAppBillingServiceConnection (_activity, publicKey);

value of _serviceConnection.Service has  {md50890773b370883bd2a9663699cac82d1.IInAppBillingServiceStub_Proxy@5156e8e}	Com.Android.Vending.Billing.IInAppBillingServiceStub.Proxy

but on calling _serviceConnection.Connect ();

i have a message: java.Lang.IllegalArgumentException : Service Intent must be explicit: Intent { act=com.android.vending.billing.InAppBillingService.BIND }
When i fixed the same problem with radio service, i used the setClass(...) method of Intent to set the explicit class for executing. Maybe it is the same problem. Also here, with InAppBillingServiceConnection class, i have no chanсe to set 'com.android.vending' as an explicit class for intent. Only developers of this feature able to do this.
By the way, they could give us a public method to set the user class if necessary.

Comment 3 John Hardman 2016-12-01 12:34:33 UTC
Working through the Xamarin.InAppBilling Getting Started instructions. Have hit the same problem:

[0:] Java.Lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.billing.InAppBillingService.BIND }
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3511/77cb8568/source/mono/mcs/class/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143 
  at Java.Interop.JniEnvironment+InstanceMethods.CallNonvirtualBooleanMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniObjectReference type, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x000a8] in /Users/builder/data/lanes/3511/ce955cc0/source/Java.Interop/src/Java.Interop/Java.Interop/JniEnvironment.g.cs:11732 
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeVirtualBooleanMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0006b] in /Users/builder/data/lanes/3511/ce955cc0/source/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:67 
  at Android.Content.ContextWrapper.BindService (Android.Content.Intent service, Android.Content.IServiceConnection conn, Android.Content.Bind flags) [0x0006e] in /Users/builder/data/lanes/3511/ce955cc0/source/monodroid/src/Mono.Android/platforms/android-24/src/generated/Android.Content.ContextWrapper.cs:812 
  at Xamarin.InAppBilling.InAppBillingServiceConnection.Connect () [0x00029] in <f0060318c19748fbab700e0b8df1ea0a>:0 
  at MyAppAndroid.InAppPurchaseService+<OpenConnectionAsync>d__7.MoveNext () [0x0009a] in G:\tfs\MyApp\ProjectMarvinPrototype\MyApp.Android\Dependency Services\InAppPurchaseServiceAndroid.cs:167 
  --- End of managed Java.Lang.IllegalArgumentException stack trace ---
java.lang.IllegalArgumentException: Service Intent must be explicit: Intent { act=com.android.vending.billing.InAppBillingService.BIND }
	at android.app.ContextImpl.validateServiceIntent(ContextImpl.java:1308)
	at android.app.ContextImpl.bindServiceCommon(ContextImpl.java:1440)
	at android.app.ContextImpl.bindService(ContextImpl.java:1418)
	at android.content.ContextWrapper.bindService(ContextWrapper.java:632)
	at mono.java.lang.RunnableImplementor.n_run(Native Method)
	at mono.java.lang.RunnableImplementor.run(RunnableImplementor.java:30)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:148)
	at android.app.ActivityThread.main(ActivityThread.java:7325)
	at java.lang.reflect.Method.invoke(Native Method)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)

I am using Xamarin.Forms and xamstore-xamarin.inappbilling 1.5.0
Comment 4 John Hardman 2016-12-01 13:40:57 UTC
A bit more experimenting:

On my Samsung Galaxy J5, running Android 6.0.1, it throws the exception shown above.

On my Motorola Moto E, running Android 5.1, it throws the exception shown above.

On my Asus K010 notebook, running Android 4.4.2, it works and OnConnected is fired.

On my Amazon Fire tablet, running Fire OS, it doesn't throw the exception, but doesn't fire OnConnected either (probably as there is no Google Play Store app?)

From a bit of Googling, it sounds like something changed with Android 5, but I would assume that the Xamarin.InAppBilling component has not been updated accordingly.
Comment 5 John Hardman 2016-12-01 17:48:51 UTC
Can somebody change the status of this from NEEDINFO back to NEW please. Info has now been provided.
Comment 6 John Hardman 2016-12-05 11:38:33 UTC
Ok - solved the problem I was hitting. The InAppBilling library wrapped as a NuGet package (xamstore-xamarin.inappbilling) is out of date.

To workaround this, download the Xamarin InAPpBilling component directly from the Component Store instead.

The InAppBilling package in NuGet needs to be updated or removed.