Android Question BillingSupported getting called again

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have in my Starter Create sub call
B4X:
                   gBillingManager.Initialize("BillingManager", gBMK)                                                          
                   return

B4X:
Public  Sub BillingManager_BillingSupported(Supported As Boolean, Message As String)
  
'           #if Debug
           Log("BillingManager_BillingSupported:" &Supported &"  Message:" &Message &"   Subscriptions(" &gBillingManager.SubscriptionsSupported &")")  
'           #end if   

                '  Do some work and call
                 gBillingManager.GetOwnedProducts

Now I put out the Log message above and what happens is when my App is left running and the screen goes blank I see another call to BillingSupported

B4X:
Logger connected to:  samsung SM-T210R
--------- beginning of /dev/log/main
running waiting messages (8)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
*** Service (starter) Create ***
Service_Create
Service_Create - Waiting for Main
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Service_Create - Main Available
Continue_Create
SN:RF2D60E3PGP DeviceID:4100727b19635000
Continue_Startup
BillingManager_BillingSupported:true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Service (httputils2service) Start **
StarterProgress - Device Check
StarterProgress - Version Check
StarterProgress - Get Owned Products
StarterProgress - Process Subscriptions
BillingManager_OwnedProducts - Starter_Ready
** Activity (main) Pause, UserClosed = false **

ANOTHER CALL to BillingSupported when APP is paused

B4X:
BillingManager_BillingSupported:true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
StarterProgress - Device Check
sending message to waiting queue (CallSubDelayed - StarterProgress)
StarterProgress - Get Owned Products
sending message to waiting queue (CallSubDelayed - StarterProgress)
StarterProgress - Process Subscriptions
BillingManager_OwnedProducts - Starter_Ready
sending message to waiting queue (CallSubDelayed - StarterProgress)
sending message to waiting queue (CallSubDelayed - Starter_Ready)
StarterProgress - Version Check
sending message to waiting queue (CallSubDelayed - StarterProgress)
StarterProgress - Get Owned Products
sending message to waiting queue (CallSubDelayed - StarterProgress)
StarterProgress - Process Subscriptions
BillingManager_OwnedProducts - Starter_Ready
sending message to waiting queue (CallSubDelayed - StarterProgress)
sending message to waiting queue (CallSubDelayed - Starter_Ready)
running waiting messages (8)
** Activity (main) Resume **

WHY would BillingSupported being called again when APP is paused.
Almost seems like my Starter App is being created again, but yet I do not see any LOG messages from it.

Is this normal for BillingSupported to be called over???

Never noticed this before.

BobVal

Note: still using 7.3 on this app
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Added a timer to the log messages
B4X:
*** Service (starter) Create ***
Service_Create
Service_Create - Waiting for Main
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Service_Create - Main Available
Continue_Create
SN:RF2D60E3PGP DeviceID:4100727b19635000
Activity_Resume
Continue_Startup
Create_Screen
BillingManager_BillingSupported - Time:17:00:52  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Service (httputils2service) Start **
StarterProgress - Device Check
StarterProgress - Version Check
Version[B*Bs-v2.77]  CurrentVersion[B*Bs-v2.77]
StarterProgress - Get Owned Products
StarterProgress - Process Subscriptions
BillingManager_OwnedProducts - Starter_Ready
** Activity (main) Pause, UserClosed = false **
Activity_Pause
** Activity (main) Resume **
Activity_Resume
Create_Screen
** Activity (main) Pause, UserClosed = false **
Activity_Pause
BillingManager_BillingSupported - Time:17:31:16  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
BillingManager_BillingSupported - Time:18:01:40  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
BillingManager_BillingSupported - Time:18:32:03  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
BillingManager_BillingSupported - Time:19:02:27  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
BillingManager_BillingSupported - Time:19:32:50  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
BillingManager_BillingSupported - Time:20:03:14  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
BillingManager_BillingSupported - Time:20:33:38  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
BillingManager_BillingSupported - Time:21:04:02  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
BillingManager_BillingSupported - Time:21:34:25  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
BillingManager_BillingSupported - Time:22:04:49  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping

And it seems like every 30 minutes I am getting a BillingSupported callback while the App is paused?

Anyone have any ideas why this would be happening?

Is this only happening because I called BillingManager from within my Stater Service?
 
Last edited:
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
No. I just added a log message in Service_Destroy to verify that and just realized my B4A Bridge is old (updating now).

Thought it was like a heart beat from billing manager to let me know it was still active (or still available for requests).
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Starter Service_Destroy not being called.

B4X:
Logger connected to:  samsung SM-T210R
--------- beginning of /dev/log/main
*** Service (starter) Create ***
Service_Create
Service_Create - Waiting for Main
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Service_Create - Main Available
Continue_Create
SN:RF2D60E3PGP DeviceID:4100727b19635000
Activity_Resume
Continue_Startup
Create_Screen
BillingManager_BillingSupported - Time:09:50:59  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Service (httputils2service) Start **
StarterProgress - Device Check
StarterProgress - Version Check
Version[B*Bs-v2.77]  CurrentVersion[B*Bs-v2.77]
StarterProgress - Get Owned Products
StarterProgress - Process Subscriptions
BillingManager_OwnedProducts - Starter_Ready
** Activity (main) Pause, UserClosed = false **
Activity_Pause
BillingManager_BillingSupported - Time:10:21:11  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping

Is there a timer somewhere in BillingManager?

NOTE: Not sure if it matters. Connected to device using bridge but not actually running the debugger.
Log messages are showing up because of Logger connected to: samsung SM-T210R

Not sure if it matters I will try being connected with debugger and see what happens.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Ran in debug mode and got some messages that might help:

B4X:
Logger connected to:  samsung SM-T210R
--------- beginning of /dev/log/main
BillingManager_BillingSupported - Time:10:21:11  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
** Activity (main) Resume **
Activity_Resume
Create_Screen
** Activity (main) Pause, UserClosed = false **
Activity_Pause
Logger connected to:  samsung SM-T210R
--------- beginning of /dev/log/main
BillingManager_BillingSupported - Time:10:21:11  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping
** Activity (main) Resume **
Activity_Resume
Create_Screen
** Activity (main) Pause, UserClosed = false **
Activity_Pause
*** Service (starter) Create ***
Service_Create
Service_Create - Waiting for Main
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Service_Create - Main Available
Continue_Create
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for com.BOBs.BBS
Subscriptions AVAILABLE.
Create_Screen
BillingManager_BillingSupported - Time:10:35:52  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
*** Service (httputils2service) Create ***
** Service (httputils2service) Start **
** Service (httputils2service) Start **
StarterProgress - Device Check
StarterProgress - Version Check
Version[B*Bs-v2.77]  CurrentVersion[B*Bs-v2.77]
StarterProgress - Get Owned Products
Starting async operation: refresh inventory
Querying owned items, item type: inapp
Package name: com.BOBs.BBS
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.BOBs.BBS
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
StarterProgress - Process Subscriptions
BillingManager_OwnedProducts - Starter_Ready
** Activity (main) Pause, UserClosed = false **
Activity_Pause
Billing service disconnected.                                                   <===================  Getting this Disconnected  WHY?
Billing service connected.                                                          <===================  Getting Connected
Checking for in-app billing 3 support.                                                              <=========
In-app billing version 3 supported for com.BOBs.BBS                                          <=========
Subscriptions AVAILABLE.                                                                             <=========
BillingManager_BillingSupported - Time:10:51:35  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)      <==== Then I get a call to BillingSupported
Another Call to gBillingSupportedAlreadyCalled - skipping
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
B4X:
** Activity (main) Pause, UserClosed = false **
Activity_Pause

Billing service disconnected.
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for com.BOBs.BBS
Subscriptions AVAILABLE.
BillingManager_BillingSupported - Time:10:51:35  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping

Billing service disconnected.
Billing service connected.
Checking for in-app billing 3 support.
In-app billing version 3 supported for com.BOBs.BBS
Subscriptions AVAILABLE.
BillingManager_BillingSupported - Time:11:21:59  true  Message:Setup successful. (response: 0:OK)   Subscriptions(true)
Another Call to gBillingSupportedAlreadyCalled - skipping

Well at least consistent. Around every 30 minutes there is a Billing Service Disconnect and a Billing Service Connect which seems to lead to a BillingSupported being called in my Service.

Am I suppose to handle Billing service disconnect? Is there a _BillingServiceDisconnect?

Right now I have a global flag I am setting that knows that BillingSupported has been called and just returns out of the routine.

BobVal
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
Am I suppose to handle Billing service disconnect?
No.

You can change your code to:
B4X:
gBillingManager.Initialize("BillingManager", gBMK) 
Wait For BillingManager_BillingSupported(Supported As Boolean, Message As String)
If Supported Then
 ...

This code is simpler and it will only handle the first event.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
That works.

So you don't think there is a problem that BillingSupported gets called more than once?


"Wait for" (I believe) wasn't available when I wrote the original code.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…