Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all articles
Browse latest Browse all 58056

Xamarin.InAppBillling: No response from InAppBillingServiceConnection.Connect()

$
0
0

Hi

I'm trying to get in app billing to work for android (inside a Xamarin.Forms app) but somehow I don't get any response from the InAppBillingServiceConnection. I've followed the instructions on http://components.xamarin.com/gettingstarted/xamarin.inappbilling.

I've put all my code in the MainActivity class right now just to show you what I've got:

    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsApplicationActivity
    {
        InAppBillingServiceConnection _serviceConnection;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            GlobalHelper.MainActivity = this;

            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());

            _serviceConnection = new InAppBillingServiceConnection (this, publicKey);
            _serviceConnection.OnConnected += HandleOnConnected;
            _serviceConnection.OnInAppBillingError += HandleOnInAppBillingError;
            _serviceConnection.OnDisconnected += HandleOnDisconnected;

            // Attempt to connect to the service
            _serviceConnection.Connect();
        }

        void HandleOnDisconnected ()
        {

        }

        void HandleOnConnected ()
        {

        }

        void HandleOnInAppBillingError (InAppBillingErrorType error, string message)
        {

        }
    }

I've binded to all events but none of them get fired. Any idea what I'm doing wrong here?

Thanks


Viewing all articles
Browse latest Browse all 58056

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>