简体   繁体   中英

How to use In-App Purchase promo code use in my android application?

I am trying to use In-App Purchase promo code in my android application. Same as define in “In-app Promotions” in developer “billing_promotions” page. But it not works properly, when I am uninstalling my app, my promo code not work. The application again shows the purchase button and the promo code not work, it says the promo code already used. How to detect purchased the app using promo code. How I can solve it?

My In-App Purchase promo code step In my activity's onResume() method use getPurchases(), within my onResume() method I use BroadcastReceiver and register my BroadcastReceiver as myPromoReceiver, using “IntentFilter - PURCHASES_UPDATED”

In my activity's onActivityResult()

And unRegisterReceiver(myPromoReceiver) in onPause() method.

Still it's not work, how I can solve it? Please help me.

Follow the instructions here carefully: https://developer.android.com/training/in-app-billing/preparing-iab-app.html

and also have a look at the sample code: https://github.com/googlesamples/android-play-billing/tree/master/TrivialDrive

If you follow it carefully, it should work. The sample code already has the PURCHASES_UPDATED broadcastReceiver implemented, so you don't have to do it (it's implemented in IabBroadcastReceiver.java ).

Good luck!

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