Hi ,
I am trying to test inapp billing in a small project . Followed Erel's tutorial . Uploaded apk to store . obtained key , added managed product in inapp products . When I tried to test in my device ,an error says "The item you were attempting to purchase could not be found "
this is my code :
I am trying to test inapp billing in a small project . Followed Erel's tutorial . Uploaded apk to store . obtained key , added managed product in inapp products . When I tried to test in my device ,an error says "The item you were attempting to purchase could not be found "
this is my code :
B4X:
Sub Globals
'These global variables will be redeclared each time the activity is created.
'These variables can only be accessed from this module.
Private btnBuy As Button
Private btnGo As Button
Dim manager As BillingManager3
Private key As String = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtKs+EKiUgwa4K+GxeBZp5FeD5pmb1R/JsOLLSu54zcugEHb445qM1tfvvO+Tmd+WkGVDYi8smi8M40W2X/93XrRg4y9TDh5dUrZxrM9JF7nkta8Jn3zmrCDZYnFHTxSKMWCcMmmUnop+uDCZY7aZ8+V3xvSIsWqQ26icdHCdV57zUWisLmZurwOyWGTzgg0wavuYcdP3lyhdXjkI9J11Ws6UzCrbY4KztXllAdaVlnuRNd+LKMvW7MopLU6Y8Q1znajAVYDUswP2As8du2HXUyp4hIYNLpuoLdCDKEBjNnI53VV2y30Ld7ecML40pDEI4hCz7mOWCTWMaVyn1dV29wIDAQAB"
Dim Productid1 As String = "sgj_inapp_photo"
Dim Producttype As String
Dim DeveloperPayload As String
DeveloperPayload = "Seller" ' ---> Name of my App "
Producttype="inapp" ' ---> this is an input
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("1")
btnGo.Visible = False
If FirstTime Then
manager.Initialize("manager", key)
manager.DebugLogging = True
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Manager_BillingSupported (Supported As Boolean, Message As String)
Log(Supported & ", " & Message)
Log("Subscriptions supported: " & manager.SubscriptionsSupported)
'manager.GetOwnedProducts
End Sub
Sub manager_OwnedProducts (Success As Boolean, purchases As Map)
Log(Success)
If Success Then
btnBuy.Visible = False
btnGo.Visible = True
Log(purchases)
For Each p As Purchase In purchases.Values
Log(p.ProductId & ", Purchased? " & (p.PurchaseState = p.STATE_PURCHASED))
Next
End If
End Sub
Sub btnBuy_Click
Dim s As Int
s = Msgbox2("Please buy the full version","SGJoisa","Ok","","Cancel",Null)
If s = DialogResponse.POSITIVE Then
manager.RequestPayment(Productid1,Producttype,DeveloperPayload)
End If
End Sub