Android Question In App Billing V3 question.

jamesgrigg01

Member
Licensed User
Longtime User
Using the sub:

B4X:
Sub manager_PurchaseCompleted (Success As Boolean, Product As Purchase)

How am i able to program it so that if a product is purchased, a boolean is changed.

Thanks, James.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I recommend you to handle the OwnedProducts event. This will allow you to check the owned products when the program starts.

In the PurchaseCompleted event (and when your program starts) you can call manager.GetOwnedProducts. This will raise the OwnedProducts event:

B4X:
Sub manager_OwnedProducts (Success As Boolean, Purchases As Map)
 If Success And Purchases.ContainsKey("YourProduct") Then
   'Do what ever you need to do
 End If
End Sub
 
Upvote 0

jamesgrigg01

Member
Licensed User
Longtime User
I recommend you to handle the OwnedProducts event. This will allow you to check the owned products when the program starts.

In the PurchaseCompleted event (and when your program starts) you can call manager.GetOwnedProducts. This will raise the OwnedProducts event:

B4X:
Sub manager_OwnedProducts (Success As Boolean, Purchases As Map)
If Success And Purchases.ContainsKey("YourProduct") Then
   'Do what ever you need to do
End If
End Sub
Since i only have one product can i just use success instead without including "And purchases.containskey("")"?

Thanks, James.
 
Upvote 0
Top