android - 如何在我的android应用程序中插入促销代码以购买商品?

标签 android google-play promotion-code

我已经在我的应用程序中实现了InApp购买,并且可以正常工作。现在想使用促销代码自由获取物品。

在文档中说:您的应用程序应允许用户在应用程序内部兑换促销代码。如果您的应用支持应用内购买工作流程(如发出应用内结算请求所述),则您的应用会自动支持促销代码在应用内的兑换。当您启动应用内购买界面时,用户可以选择使用促销代码来支付购买费用。 https://developer.android.com/google/play/billing/billing_promotions.html
But in my application there is not any option to select for promo code. There is only buy option. How can user insert promo code inside app?
这些图片来自PlayStore应用。有Redeem对话框,看起来像peyment对话框。可以按照本文和以下图片中所述从play store应用程序中打开它。我可以按照以下流程插入我的促销代码,它可以正常工作。 http://www.greenbot.com/article/3043048/android/how-to-redeem-a-google-play-store-promo-code.html
enter image description here
Redeem dialog

最佳答案

在此SO中,您找到的解决方案

修改代码

String code = "request code with dialog"
try {
    String url = "https://play.google.com/redeem?code=" + URLEncoder.encode(code, "UTF-8");
    context.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
} catch (android.content.ActivityNotFoundException e) {
  // Play Store app is not installed
}

关于android - 如何在我的android应用程序中插入促销代码以购买商品?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40342249/

相关文章:

java - "org.xmlpull.v1.XmlPullParserException: expected: START_TAG"错误

android - Google Play 促销代码

android - Google Play 管理中心促销的开始和结束日期

ios - 即时应用商店促销代码?

algorithm - Google Adwords 促销代码背后的数学原理是什么?如何在自定义应用程序中复制它们?

Android StateListDrawable 在 MultiTouch 之后保持按下状态

屏幕旋转后立即调用 Android Checkbox 监听器方法

java - 如何在android中制作xml格式的表格数据

google-play - 来自非营利性公司的Google Play免费应用中的Paypal捐款

firebase - 阻止合并 AD_ID 权限会影响 Firebase 功能吗?