I implemented promo codes in my app, the user redeems the promo code in Play Store.
When the app starts, each time it have to ask for the owned products to check if the user entered or not the promo code. From the user's perspective, after redeeming the code in the play store the changes have to apply as soon the user opens the app again.
This is the code I use:
since there is no way to tell if the manager is initialized I assume that if Firstime = false it is already initialized, I added a try catch block to protect that part of the code anyways.
Im not sure which part of the code is causing this issue but I get this error: (As soon as I opened the app, the app doesn't even launch completely)
Someone knows what could be wrong? This error happens once in a while, from firebase crash report I noticed that very few users had this issue, for me it happened for the first time in almost a month.
Maybe there is another approach to check the owned products on each app start?
When the app starts, each time it have to ask for the owned products to check if the user entered or not the promo code. From the user's perspective, after redeeming the code in the play store the changes have to apply as soon the user opens the app again.
This is the code I use:
B4X:
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
manager.Initialize("manager", inappkey)
manager.DebugLogging = False
Else
Try
manager.GetOwnedProducts
Catch
' Log(LastException)
End Try
End If
End Sub
since there is no way to tell if the manager is initialized I assume that if Firstime = false it is already initialized, I added a try catch block to protect that part of the code anyways.
Im not sure which part of the code is causing this issue but I get this error: (As soon as I opened the app, the app doesn't even launch completely)
B4X:
java.lang.NullPointerException: Attempt to invoke interface method 'android.os.Bundle com.android.vending.billing.IInAppBillingService.getPurchases(int, java.lang.String, java.lang.String, java.lang.String)' on a null object reference
at anywheresoftware.b4a.objects.IbHelper.queryPurchases(IbHelper.java:836)
at anywheresoftware.b4a.objects.IbHelper.queryInventory(IbHelper.java:544)
at anywheresoftware.b4a.objects.IbHelper.queryInventory(IbHelper.java:523)
at anywheresoftware.b4a.objects.IbHelper$3.run(IbHelper.java:616)
at java.lang.Thread.run(Thread.java:762)
Someone knows what could be wrong? This error happens once in a while, from firebase crash report I noticed that very few users had this issue, for me it happened for the first time in almost a month.
Maybe there is another approach to check the owned products on each app start?