Android Question InApp problem (InApp purchase is confirmed but acts like never purchased)

muratkazma

Member
Licensed User
Hello,

I developed a new application for barbers. Currently installed and active on the market. It can be reviewed at https://play.google.com/store/apps/details?id=com.uygarteknoloji.berber. There are 7 different modules and each module has 2 different purchase options. It can be purchased in the form of Inapp and subs. No problem with subs. (Actually, there is another interesting problem there too. Subs did not recognize the type but it works. I gave the error message below) When purchased as a subscription, everything works normally. However, when it is purchased in the form of Inapp, the purchase is complete, but when it closes and opens the app, it wants to buy it again as if it was never purchased. What am I supposed to do?

Logs are below :

Puchase Logs :

Starting async operation: launchPurchaseFlow
Constructing buy intent for barber_appointments_lifetime, item type: inapp
requestCode = 2
** Activity (satinal) Pause, UserClosed = false **
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
Arrived: 2, 2
Ending async operation: launchPurchaseFlow
Successful resultcode from purchase activity.
Purchase data: {"orderId":"GPA.3363-3575-9819-52231","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_lifetime","purchaseTime":1591096171595,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"hagekihmfigefjmhjlhgdpnk.AO-J1Oy37kR4ebh_h1aVNzcgxIWUbHQSQZzqEi66kkq0mgBKtK5aZK3cfAYqwdTOKaY3q93UzCWkVDj-KISSl2XMskhe6OCnZj7AciKScsOq8gRsMGLv4Fhp-rRBibOMtGt6Z-oKQQPCsdtUymMs7zs13RXXZ_Asmw"}
Data signature: h9efWkzZTrlTLQ657n8zfMc+7Httz38VsSmBBgLW+aeFnFQGAGDRKAqnzpHaKsUqjwsbA5iAdW3ePa1XcvfwikBFdECKO0VeLcP0bo1VVmoiA97PeVYNNqfBwQI3Yo+pA7R+MNJFN3aEIRR8n5V2Tremkta2LwhdFErcKmRwmIc9Ld0oGJWPb35MNz6By75Mnwinj8hW5tgqowsDYBlv5rxF7LTowxswd+cuWMJqO4deZpjlPMdv07U6oJb9+tztQ42hqGK+5dWD//faxbawr7ArJSUrHtixLR/njsMq0FQ/sqYeCafdo1LI5a1lKfXkr62+AMEIEExZebbR7kAchg==
Extras: Bundle[{INAPP_PURCHASE_DATA={"orderId":"GPA.3363-3575-9819-52231","packageName":"com.uygarteknoloji.berber","productId":"barber_appointments_lifetime","purchaseTime":1591096171595,"purchaseState":0,"developerPayload":"Appointments","purchaseToken":"hagekihmfigefjmhjlhgdpnk.AO-J1Oy37kR4ebh_h1aVNzcgxIWUbHQSQZzqEi66kkq0mgBKtK5aZK3cfAYqwdTOKaY3q93UzCWkVDj-KISSl2XMskhe6OCnZj7AciKScsOq8gRsMGLv4Fhp-rRBibOMtGt6Z-oKQQPCsdtUymMs7zs13RXXZ_Asmw"}, INAPP_DATA_SIGNATURE=h9efWkzZTrlTLQ657n8zfMc+7Httz38VsSmBBgLW+aeFnFQGAGDRKAqnzpHaKsUqjwsbA5iAdW3ePa1XcvfwikBFdECKO0VeLcP0bo1VVmoiA97PeVYNNqfBwQI3Yo+pA7R+MNJFN3aEIRR8n5V2Tremkta2LwhdFErcKmRwmIc9Ld0oGJWPb35MNz6By75Mnwinj8hW5tgqowsDYBlv5rxF7LTowxswd+cuWMJqO4deZpjlPMdv07U6oJb9+tztQ42hqGK+5dWD//faxbawr7ArJSUrHtixLR/njsMq0FQ/sqYeCafdo1LI5a1lKfXkr62+AMEIEExZebbR7kAchg==, RESPONSE_CODE=0}]
Expected item type: inapp
Purchase signature successfully verified.
Starting async operation: consume
Consuming sku: barber_appointments_lifetime, token: hagekihmfigefjmhjlhgdpnk.AO-J1Oy37kR4ebh_h1aVNzcgxIWUbHQSQZzqEi66kkq0mgBKtK5aZK3cfAYqwdTOKaY3q93UzCWkVDj-KISSl2XMskhe6OCnZj7AciKScsOq8gRsMGLv4Fhp-rRBibOMtGt6Z-oKQQPCsdtUymMs7zs13RXXZ_Asmw
** Activity (satinal) Resume **
** Activity (satinal) Pause, UserClosed = true **
** Activity (randevular) Create, isFirst = true **
** Activity (randevular) Resume **
Successfully consumed sku: barber_appointments_lifetime
Ending async operation: consume

After Program Restart :


*** Service (starter) Create ***
** Service (starter) Start **
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for com.uygarteknoloji.berber
Subscriptions AVAILABLE.
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
true, Setup successful. (response: 0:OK)
Subscriptions supported: true
Starting async operation: refresh inventory
Querying owned items, item type: inapp
Package name: com.uygarteknoloji.berber
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.uygarteknoloji.berber
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

Starter:
Sub Service_Create
    'This is the program entry point.
    'This is a good place to load resources that are not specific to a single activity.
    manager.Initialize("manager", key)
    manager.DebugLogging = True
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
        For Each p As Purchase In purchases.Values
            Log(p.Productid & ", Purchased? " & (p.PurchaseState = p.STATE_PURCHASED))
        Next
    End If
End Sub

Purchase:
Sub btnLifetime_Click
    If kabul.Value=False Then
        Msgbox2Async(CRLF & genel.ResourceStrings.Get("LicenseAgreementMessage") & CRLF, genel.ResourceStrings.Get("MainActivityTitle"), "", "", "", Null, True)
    Else
        Select form
            Case 1: Starter.manager.RequestPayment(Starter.ProductLifeTimeID1, "inapp", Starter.ProductName1)
            Case 2: Starter.manager.RequestPayment(Starter.ProductLifeTimeID2, "inapp", Starter.ProductName2)
            Case 3: Starter.manager.RequestPayment(Starter.ProductLifeTimeID3, "inapp", Starter.ProductName3)
            Case 4: Starter.manager.RequestPayment(Starter.ProductLifeTimeID4, "inapp", Starter.ProductName4)
            Case 5: Starter.manager.RequestPayment(Starter.ProductLifeTimeID5, "inapp", Starter.ProductName5)
            Case 6: Starter.manager.RequestPayment(Starter.ProductLifeTimeID6, "inapp", Starter.ProductName6)
            Case 7: Starter.manager.RequestPayment(Starter.ProductLifeTimeID7, "inapp", Starter.ProductName7)
        End Select
    End If
End Sub

Sub btnSubscription_Click
    If kabul.Value=False Then
        Msgbox2Async(CRLF & genel.ResourceStrings.Get("LicenseAgreementMessage") & CRLF, genel.ResourceStrings.Get("MainActivityTitle"), "", "", "", Null, True)
    Else
        Select form
            Case 1: Starter.manager.RequestPayment(Starter.ProductSubscriptionID1, "subs", Starter.ProductName1)
            Case 2: Starter.manager.RequestPayment(Starter.ProductSubscriptionID2, "subs", Starter.ProductName2)
            Case 3: Starter.manager.RequestPayment(Starter.ProductSubscriptionID3, "subs", Starter.ProductName3)
            Case 4: Starter.manager.RequestPayment(Starter.ProductSubscriptionID4, "subs", Starter.ProductName4)
            Case 5: Starter.manager.RequestPayment(Starter.ProductSubscriptionID5, "subs", Starter.ProductName5)
            Case 6: Starter.manager.RequestPayment(Starter.ProductSubscriptionID6, "subs", Starter.ProductName6)
            Case 7: Starter.manager.RequestPayment(Starter.ProductSubscriptionID7, "subs", Starter.ProductName7)
        End Select
    End If
End Sub

Manifest Editor:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: http://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="28"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
SetActivityAttribute("main", android:label, "@string/MainActivityTitle")
'End of default text.
'InAppBilling declarations - Start
AddReceiverText(Starter,  <intent-filter>
                <action android:name="com.android.vending.billing.IN_APP_NOTIFY" />
                <action android:name="com.android.vending.billing.RESPONSE_CODE" />
                <action android:name="com.android.vending.billing.PURCHASE_STATE_CHANGED" />
            </intent-filter>)
'InAppBilling declarations - End
CreateResourceFromFile(Macro, GooglePlayBilling.GooglePlayBilling)
SetApplicationAttribute(android:theme, "@style/MyAppTheme")
CreateResource(values, theme.xml,
<resources>
    <style name="MyAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="colorPrimary">#0098FF</item>
        <item name="colorPrimaryDark">#007CF5</item>
        <item name="colorAccent">#AAAA00</item>
        <item name="windowNoTitle">true</item>
        <item name="windowActionBar">false</item>
        <item name="android:windowTranslucentNavigation">false</item>
         <item name="android:windowTranslucentStatus">true</item>
    </style>
</resources>
)

Main:
#Region  Project Attributes
    #ApplicationLabel: Barber
    #VersionCode: 5
    #VersionName:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
    #CanInstallToExternalStorage: True
    #AdditionalRes: C:\AndroidSDK\extras\google\google_play_services\libproject\google-play-services_lib\res, com.google.android.gms
#End Region

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

#Extends: android.support.v7.app.AppCompatActivity
 

muratkazma

Member
Licensed User
Thanks for your reply. I switch the new API as possible. I solved my problem. I remove consume method and now running. But I wonder,
should I remove it for subscription?
 
Upvote 0
Top