如何在 Android 上的“提供反馈”模式下启动 Google Play 意图?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2893350/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How to launch the Google Play intent in 'Give Feedback' mode on Android?
提问by Paul Maidment
I have just written a game for the Google Play Storeand would like to remind my customers to leave feedback on the market for the application (especially the demo version). Is there any way to launch the market intent in a mode that will take the user to the feedback / comments section of the page?
我刚刚为Google Play 商店编写了一个游戏,想提醒我的客户对应用程序(尤其是演示版)留下市场反馈。有没有办法以一种将用户带到页面的反馈/评论部分的模式来启动市场意图?
I already use this approach for linking my demo to the paid application...
我已经使用这种方法将我的演示链接到付费应用程序...
Intent goToMarket = null;
goToMarket = new Intent(
Intent.ACTION_VIEW,
Uri.parse("market://details?id=com.paulmaidment.games.flagsoftheworld"));
startActivity(goToMarket);
Is there a best practice?
有最佳实践吗?
Additionally, is there any way to track referrals from my demo application so that I can try to calculate some kind of a conversion rate? (that is, how effective the demo application is at generating sales.)
此外,是否有任何方法可以跟踪来自我的演示应用程序的推荐,以便我可以尝试计算某种转化率?(也就是说,演示应用程序在产生销售方面的效果如何。)
采纳答案by arnodenhond
I'm not sure if its possible for an intent to take a user directly into the feedback/comments section. The developer guide does not mention that possibility.
我不确定是否有可能将用户直接带入反馈/评论部分。开发人员指南没有提到这种可能性。
As for tracking referrals you might want to check out this: http://code.google.com/mobile/analytics/docs/android/#android-market-tracking
至于跟踪推荐,你可能想看看这个:http: //code.google.com/mobile/analytics/docs/android/#android-market-tracking
回答by android developer
Note that in order to make the activities flow more expected for the end user, you should consider adding some intent flags. I suggest:
请注意,为了使最终用户更期望活动流,您应该考虑添加一些意图标志。我建议:
String appPackageName= getPackageName();
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("market://details?id="+appPackageName));
marketIntent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET|Intent.FLAG_ACTIVITY_MULTIPLE_TASK|Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(marketIntent);
This way, when the user is pressing back, he will get to your application and not stay on the market (if he was there before). Also, if the user has opened your app again (after it was gone to the background), the market won't show up.
这样,当用户回按时,他将进入您的应用程序,而不是留在市场上(如果他之前在那里)。此外,如果用户再次打开您的应用程序(在它进入后台之后),市场将不会出现。
You can also add a try catch for the startActivity()
call, so that you will be able to show the website of the app if the market is not available (either uninstalled somehow, or because the device's company didn't include it).
您还可以为startActivity()
呼叫添加一个 try catch ,这样您就可以在市场不可用时显示应用程序的网站(以某种方式卸载,或者因为设备的公司没有包含它)。
EDIT: another alternative is How to use Intent.ACTION_APP_ERROR as a means for a “feedback” framework in Android?
编辑:另一种选择是如何使用 Intent.ACTION_APP_ERROR 作为 Android 中“反馈”框架的一种手段?