简体   繁体   中英

Is there a way to redeem a promo code from within the app?

Since beginning of this year, it's possible to use promo codes for apps: Create promotions

As described on the page In-app Promotions , promo codes can also be redeemed from within the app.

It also says "You can also keep a SKU off the Play Store, so the only way to get that item is by entering that SKU's promo code.".

That's what I want for an in app product: Only let a user get an in app product by entering the promo code within the app and do not allow to buy it with money.

How can this be done?

By analyzing the Play Store app I found out that the current version opens the "Redeem your code" dialog with the following intent:

try {
  final Uri redeemUri = Uri.parse("https://play.google.com/redeem");
  final Intent redeemIntent = new Intent(Intent.ACTION_VIEW, redeemUri);
  startActivity(redeemIntent);
} catch (android.content.ActivityNotFoundException e) {
  // Play Store app is not installed
}

Please note that this may change in any new version of Play Store.

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