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

て烟熏妆下的殇ゞ 提交于 2019-12-31 03:00:14

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!