private async Task <bool> CheckPurchase() { try { if (_billingHelper == null) { Toast.MakeText(this, "عدم اتصال به کافه بازار و یا مایکت لطفا برنامه را مجددا اجرا کنید", ToastLength.Long); return(false); } var products = await _billingHelper.QueryInventoryAsync(new List <string>() { Billing.Billing.Sku }, ItemType.Subscription); if (products == null || !products.Any()) { Toast.MakeText(this, "لطفا در اپلیکیشن کافه بازار و یا مایکت وارد اکانت شوید ", ToastLength.Long); return(false); } var isPurchase = _billingHelper.GetPurchases(ItemType.InApp); if (isPurchase != null && isPurchase.Any(en => en.ProductId == products.FirstOrDefault().ProductId)) { return(true); } _billingHelper.LaunchPurchaseFlow(Billing.Billing.Sku, ItemType.Subscription, ""); return(false); } catch (Exception er) { var msg = er.Message; return(false); } }
public override bool OnOptionsItemSelected(IMenuItem item) { if (item.ItemId == Resource.Id.action_settings) { StartActivity(typeof(SettingsActivity)); } if (item.ItemId == Resource.Id.action_buy) { if (_billingHelper != null) { _billingHelper.LaunchPurchaseFlow(RemoveAdsSku, ItemType.InApp, ""); } else { Toast.MakeText(this, "In app purchase not available", ToastLength.Long).Show(); } ToggleAdIfNeeded(); } return(base.OnOptionsItemSelected(item)); }
private void Button1_Click(object sender, EventArgs e) { _billingHelper.LaunchPurchaseFlow("goleverestekhdam", "inapp", "payload"); }