问题
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?
回答1:
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.
来源:https://stackoverflow.com/questions/35999817/is-there-a-way-to-redeem-a-promo-code-from-within-the-app