protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); Xamarin.Essentials.Platform.Init(this, savedInstanceState); SetContentView(Resource.Layout.activity_main); Android.Support.V7.Widget.Toolbar toolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar); SetSupportActionBar(toolbar); FloatingActionButton fab = FindViewById <FloatingActionButton>(Resource.Id.fab); fab.Click += FabOnClick; try { _connectionHelper = new InAppBillingConnectionHelper(this, Config.BazarKey); _connectionHelper.OnConnected += async(sender, e) => { _billingHelper = _connectionHelper.BillingHelper; }; _connectionHelper.Connect(); } catch (Exception er) { var d = er.Message; } }
public void OnServiceDisconnected(ComponentName name) { Connected = false; Service = null; BillingHelper = null; RaiseOnDisconnected(); }
private void HandleOnConnected(object sender, EventArgs e) { _billingHelper = _serviceConnection.BillingHelper; #if DEBUG if (_billingHelper != null) { Toast.MakeText(this, "Connected to in app billing service", ToastLength.Short).Show(); } else { Toast.MakeText(this, "Connected to in app billing service but helper is null", ToastLength.Short).Show(); } #endif ToggleAdIfNeeded(); InvalidateOptionsMenu(); }
void HandleOnConnected(object sender, EventArgs e) { _billingHelper = _serviceConnection.BillingHelper; }