Hi,
I have used Sample IAP code from Sample IAP Project and tested for one consumable item. I created a gameObject with MyIAPManager.cs attached. The button OnClick runs BuyProductID method like below:
void BuyProductID(string productId)
{
if (IsInitialized())
{
Product product = m_StoreController.products.WithID(productId);
if (product != null && product.availableToPurchase)
{
MyDebug(string.Format("Purchasing product:" + product.definition.id.ToString()));
m_StoreController.InitiatePurchase(product);
}
else
{
MyDebug("BuyProductID: FAIL. Not purchasing product, either is not found or is not available for purchase");
}
}
else
{
MyDebug("BuyProductID FAIL. Not initialized.");
}
}
THE PROBLEM: Everything works fine in the editor but on Android device the app crashes just after this line:
MyDebug(string.Format(“Purchasing product:” + product.definition.id.ToString()));
It looks that a product is available to purchase but m_StoreController.InitiatePurchase(product) causes that crash. I can’t figure out what is the problem. I tried many things already, even the stuff like clearing the cache or editing the path to Unity to be without any spaces, but nothing helped out.
The app is made for Google Cardboard and used to well on Android (purchase window was showing show normally) when compiled in Unity 2018. I’ve started to get this issue after upgrading to unity 2019. I’ve upgraded IAP to 1.23.
It HAPPENS ONLY if in XR Settings >> Virtual Reality Supported & Cardboard are chosen.
If VR stuff is off all works well.
In attachment my logcat from Android(company, app and product names have been replaced).
Thanks in advance!
5192624–516077–log.txt (16.8 KB)
