Pete
Pete

Reputation: 197

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?

Upvotes: 2

Views: 3109

Answers (1)

Pete
Pete

Reputation: 197

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.

Upvotes: 1

Related Questions