简体   繁体   中英

Android in-app purchase multiple subscriptions

I'm implementing the in-app purchase lib by google and i have a question about subscriptions :

  • is there possible to have 2 or more subscriptions active and renewable ?

I used the following code where i know i have subscribe to two items:

Purchase.PurchasesResult result = mBillingClient.queryPurchases(BillingClient.SkuType.SUBS);
if (result!=null && result.getPurchasesList()!=null && result.getPurchasesList().size()>0) {

        Toast.makeText(context,"SUB 1: "+result.getPurchasesList().get(0).getSku()+"/"+result.getPurchasesList().get(0).isAutoRenewing(),Toast.LENGTH_LONG).show();
        Toast.makeText(context,"SUB 2: "+result.getPurchasesList().get(1).getSku()+"/"+result.getPurchasesList().get(1).isAutoRenewing(),Toast.LENGTH_LONG).show();

    }

The result for both is true on :

result.getPurchasesList().get(0).isAutoRenewing()
result.getPurchasesList().get(1).isAutoRenewing()

In the first place i substribe for the first and then for the second. My expectation was to recive above only for the second one TRUE for isAutoRenewing()

I did not use upgrade sintax. So technically : is there possible to have 2 active subs ?

Thx

Yes, it's possible to have multiple active subscriptions. Upgrade/downgrade from different subscriptions isn't by default. Depending on the methods you use, you have to specify which subscriptions to replace if you only want one active subscription at a time.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM