/// <summary> /// Starts a purchase process in the market. /// </summary> /// <param name="productId">id of the item to buy.</param> protected override void _buyMarketItem(string productId, string payload) { AndroidJNI.PushLocalFrame(100); using (AndroidJavaObject jniPurchasableItem = AndroidJNIHandler.CallStatic <AndroidJavaObject>( new AndroidJavaClass("com.soomla.store.data.StoreInfo"), "getPurchasableItem", productId)) { AndroidJNIHandler.CallVoid(jniStoreController, "buyWithMarket", jniPurchasableItem.Call <AndroidJavaObject>("getPurchaseType").Call <AndroidJavaObject>("getMarketItem"), payload); } AndroidJNI.PopLocalFrame(IntPtr.Zero); }
public static void BuyMarketItem(string productId) { #if UNITY_ANDROID && !UNITY_EDITOR AndroidJNI.PushLocalFrame(100); using (AndroidJavaObject jniPurchasableItem = AndroidJNIHandler.CallStatic <AndroidJavaObject>( new AndroidJavaClass("com.soomla.store.data.StoreInfo"), "getPurchasableItem", productId)) { AndroidJNIHandler.CallVoid(jniStoreController, "buyWithGooglePlay", jniPurchasableItem.Call <AndroidJavaObject>("getPurchaseType").Call <AndroidJavaObject>("getGoogleMarketItem"), ""); } AndroidJNI.PopLocalFrame(IntPtr.Zero); #elif UNITY_IOS && !UNITY_EDITOR storeController_BuyMarketItem(productId); #endif }