Android Question In-App Example

MarcoRome

Expert
Licensed User
Longtime User
Hi all. I have a few problem with in-app.

This is code:
B4X:
#Region  Project Attributes
#ApplicationLabel: Esempio In-App
#VersionCode: 3
#VersionName: 1.01
 'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region

#Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: True
#End Region

Sub Process_Globals
    'These global variables will be declared once when the application starts.
    'These variables can be accessed from all modules.
    Dim manager As BillingManager3
    Private key As String = "MIIBIjANBgkqhkiG9w0BA......."
    Dim Productid As String
    Dim Producttype As String
    Dim DeveloperPayload As String
    DeveloperPayload="Esempio In-App" ' ---> Name of my App "
    Producttype="inapp" ' ---> this is an input
    Productid="TestXX" ' ---> this is an input I it is the product id i defined in the store
End Sub

Sub Globals
Dim button1, button2 As Button
Dim label1 As Label
Dim ImageView1 As ImageView
End Sub

Sub Activity_Create(FirstTime As Boolean)
    If FirstTime = True Then
        manager.Initialize("manager", key)
    End If
    manager.DebugLogging = True
    Activity.LoadLayout("Main")'
End Sub

Sub Manager_BillingSupported (Supported As Boolean, Message As String)
    Log(Supported & ", " & Message)
    Log("Subscriptions supported: " & manager.SubscriptionsSupported)
    If Supported Then
        manager.GetOwnedProducts
    End If
End Sub

Sub manager_OwnedProducts (Success As Boolean, purchases As Map)
Log(Success)
If Success Then
        label1.Visible = True
        button2.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 button1_click
   
    manager.RequestPayment(Productid, Producttype, DeveloperPayload)
End Sub


   

Public Sub manager_PurchaseCompleted (Success As Boolean, Product As Purchase)
       If Success = True Then
        Select Product.Productid
            Case "TestXX"
                'qui inserisco cosa fare nel caso la transazione si andata a buon fine
                ' Faccio andare nella routine esempio sub lancia dove elimino la pubblicità
                ToastMessageShow("PLAY STORE OK Buy ;);)))))!!", False)
        End Select
    Else
        ToastMessageShow("PLAY STORE Error Buy", False)
        End If
End Sub

Sub button2_click
Msgbox("Bene","Messaggio")
End Sub


Play Store - I call TextXX in code: (Productid="TestXX")
image-1-620C_543ECDE7.jpg



When i try dont work i have this message:
image-screenshot20141015213838-0691_543ECE8A.png


Where i wrong ??
Thank you all
 

DonManfred

Expert
Licensed User
Longtime User
Last edited:
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Thank's for your response Erel.
Now isn't possible, this evening i post the log.
Thank you again for your support
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Hi Erel this is Log:

B4X:
--------- beginning of /dev/log/main
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
** Service (service1) Create **
** Service (service1) Start **
Connected to B4A-Bridge (Wifi)
Installing file.
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:com.queenandroid.testbill
Installing file.
PackageAdded: package:com.queenandroid.testbill
Installing file.
PackageAdded: package:com.queenandroid.testbill
Copying updated assets files (1)
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for com.queenandroid.testbill
Subscriptions AVAILABLE.
true, Setup successful. (response: 0:OK)
Subscriptions supported: true
Starting async operation: refresh inventory
Querying owned items, item type: inapp
Package name: com.queenandroid.testbill
Calling getPurchases with continuation token: null
Owned items response: 0
Continuation token: null
Querying SKU details.
queryPrices: nothing to do because there are no SKUs.
Querying owned items, item type: subs
Package name: com.queenandroid.testbill
Calling getPurchases with continuation token: null
Owned items response: 0
Continuation token: null
Querying SKU details.
queryPrices: nothing to do because there are no SKUs.
Ending async operation: refresh inventory
true
(MyMap) {}
Starting async operation: launchPurchaseFlow
Constructing buy intent for TestXX, item type: inapp
requestCode = 1
** Activity (main) Pause, UserClosed = false **
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Maybe i understand the problem:

https://support.google.com/googleplay/android-developer/answer/1072599

B4X:
Un ID dovrebbe essere formato da lettere minuscole (a-z), numeri (0-9), carattere di sottolineatura (_) e punto (.). Deve, inoltre, iniziare con lettere minuscole o numeri. Ad esempio, gli ID "un_id", "1_2_3" o "una.spada" sono validi, mentre gli ID "UN_ID", "_1_2_3" o ".una.spada" non lo sono....
 
An ID should consist of lowercase letters (az), numbers (0-9), underscore (_) and dot (.). It must also begin with lowercase letters or numbers. For example, IDs "un_id", "1_2_3" or "una.spada" are valid, while the ID "UN_ID", "_1_2_3" or ".una.spada" are not.

and so "TestXX" as ID isn't valid.
I will let you know
 
Upvote 0

MarcoRome

Expert
Licensed User
Longtime User
Maybe i understand the problem:

https://support.google.com/googleplay/android-developer/answer/1072599

B4X:
Un ID dovrebbe essere formato da lettere minuscole (a-z), numeri (0-9), carattere di sottolineatura (_) e punto (.). Deve, inoltre, iniziare con lettere minuscole o numeri. Ad esempio, gli ID "un_id", "1_2_3" o "una.spada" sono validi, mentre gli ID "UN_ID", "_1_2_3" o ".una.spada" non lo sono....
 
An ID should consist of lowercase letters (az), numbers (0-9), underscore (_) and dot (.). It must also begin with lowercase letters or numbers. For example, IDs "un_id", "1_2_3" or "una.spada" are valid, while the ID "UN_ID", "_1_2_3" or ".una.spada" are not.

and so "TestXX" as ID isn't valid.
I will let you know


Yes :) Problem Solved
 
Upvote 0
Top