I have used this plugin: https://github.com/jamesmontemagno/InAppBillingPlugin to implement the in app billing since the component was removed. I have installed the nuget: Plugin.InAppBilling
In the Android, I have create a class called InAppBillingService where I implement here to get the products and purchase an item. Here are the codes:
var billing = CrossInAppBilling.Current;
var connected = await billing.ConnectAsync();
And it returns false everytime. I could not connect.
I have added in my AndroidManifest this:
uses-permission android:name="com.android.vending.BILLING" />
And in the MainActivity:
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
InAppBillingImplementation.HandleActivityResult(requestCode, resultCode, data);
}
And in onCreate: CrossCurrentActivity.Current.Init(this, bundle);
Please advice what else I should do so that I could connect. And what are other reasons why it always return false when tried to connect. I'm testing in emulator. Thank you.
I'm testing in emulator.
That's the reason of the problem. As written here, Billing does not work on Android emulators. Use a real device.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With