最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

android - What functions does google play billling call when in "test subscription renewal" after the first re

matteradmin6PV0评论

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.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far