admin管理员组

文章数量:1434029

Google suggests to test "your google play billing". I do have a product with weekly and monthly renewal. I want to test the renewal. I did find that test subscriptions for 1 week are renewed after 5 minutes. This is great.

But i didnt find any information on what really is done - will a running instance of "BillingClient" be called automatically by Google, so that it calls listeners in my app ? Or will i have to rely on polling ?

This isnt documented anywhere. So if someone knows -please share your expertise.

My code is tested for the "regular" case, i.e. first order of a product. To allow use of my app when internet is down i am prepared as well, i do # store products timestamps - i found that timestamps in PurchasesResponseListener() are indeed the precise timestamps when the user bought the product the first name.

As of now i am missing 2 informations/ confirmations:

a) do i get the info via polling or via listener ?

b) if a product is renewed -will the timestamp be the time of the original (first) purchase, or will it be begin of the new period ? I would prefer the later, but i dont know ...

Google suggests to test "your google play billing". I do have a product with weekly and monthly renewal. I want to test the renewal. I did find that test subscriptions for 1 week are renewed after 5 minutes. This is great.

But i didnt find any information on what really is done - will a running instance of "BillingClient" be called automatically by Google, so that it calls listeners in my app ? Or will i have to rely on polling ?

This isnt documented anywhere. So if someone knows -please share your expertise.

My code is tested for the "regular" case, i.e. first order of a product. To allow use of my app when internet is down i am prepared as well, i do # store products timestamps - i found that timestamps in PurchasesResponseListener() are indeed the precise timestamps when the user bought the product the first name.

As of now i am missing 2 informations/ confirmations:

a) do i get the info via polling or via listener ?

b) if a product is renewed -will the timestamp be the time of the original (first) purchase, or will it be begin of the new period ? I would prefer the later, but i dont know ...

Share Improve this question asked Nov 18, 2024 at 15:48 MatthiasLMatthiasL 1397 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 0

Ok, so i did test this in the debugger now. Renewals of subscriptions do get the original time stamp.

boolean isRenewing =  pu.isAutoRenewing();
long purchasetime = Purchase.getPurchaseState(); 

So purchasetime is -not- increased with each renewal of a subscription. isAutoRenewing is true, as expected.

With respect to polling versus listeners : i do simply call BillingClient in onCreate of the application and again each time my order dialog is shown on the screen. Worstcase is that the user had the order dialog opened a minute before the subscription period renews, he/she would then not get the update correctly. Had to wait for the next start of the app or next open of the dialog.

本文标签: