Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
2.2k views
in Technique[技术] by (71.8m points)

in app purchase - In app billing v3 Android non-consumable items

I'm starting with In App Billing and I would like to sell some magazines in my app. If one user buy one magazine he can read it always. I read about consumable and non-consumable in app billing but I didn't understand how can I make a non-consumable item and how can I manage it. I have to create a consumable item in google developer console and than specify in my app with a variable that the item is non-consumable? Thank you in advance

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

First, The In-app Billing Version 3 service only supports managed in-app products so make sure that you specify that the purchase type is 'Managed' when you add new items to your product list in the Developer Console.

In In-app Billing Version 3 API once an item is purchased, it is considered to be "owned" and cannot be purchased again from Google Play. So I think we can say that per default items are non-consumable.

If you want to make this item consumable you have to call the consume function just after the purchase. Calling the consume function will "free" your item and make it "available" again. (Your user will be able to purchase it as many time as he wants)

mHelper.consumeAsync(purchase, mConsumeFinishedListener);

If you don't call the consume function, your item will never be consumed and will act like a non-consumable item.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...