在 Android 应用程序的演示/精简版中处理升级/购买点击的正确方法
我有一个应用程序的演示版本,该应用程序的功能有限,并且当用户选择演示版本中没有的功能时会发出警报,提醒他们试用版不支持该功能,并且有两种选择,购买或不,谢谢。不,谢谢,只是将它们返回到应用程序.. 购买触发了
public void onClick(DialogInterface dialog, int which) {
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"market://details?id=[My Commercial Product Package ID]"));
startActivity(marketIntent);
finish();
}
现在我的模拟器上没有 android 市场,所以点击购买按钮显然失败了.. 我对此表示同意。但我想验证该活动是否将启动并运行,并且其后的 FINISH 调用将简单地终止正在运行的演示版本,但市场应用程序将按预期启动并运行,并且不会受到 finish() 调用的影响。
这是一个正确的假设吗?
I have a demo verison of an app that I have limited features of and brings up an alert when a user picks a featuer not in the demo version alerting them it isn't supported in the trial and two choices, buy or no thanks.. no thanks just returns them to the app.. buy triggers a
public void onClick(DialogInterface dialog, int which) {
Intent marketIntent = new Intent(Intent.ACTION_VIEW, Uri.parse(
"market://details?id=[My Commercial Product Package ID]"));
startActivity(marketIntent);
finish();
}
Now I don't have android marketplace on my emulator, so clickon on the buy button obviosly fails.. which I am okay with. But I want to verify that that activity will start and run, and the FINISH call after it will simply kill the demo version running, but the market app will fire up and run as expected and not be affected by the finish() call.
Is this a correct assumption or not?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,该代码与我在我的应用程序之一中使用的一些代码相匹配。您也正确地假设 finish() 调用将完成您来自的活动,而不是
Yes that code matches some code that I use in one of my apps. You are also correct to assume that the finish() call will finish the activity that you are coming from, not going to
请记住,完成指的是单个活动,而不是整个应用程序。
这是一篇关于如何让市场在模拟器上运行的好文章。
如何在模拟器上安装 Android Market 应用?
Just remember that finish refers to a single activity, not your entire app.
Here's a good post on how to get the Market working on the emulator.
How to install Android Market App on the emulator?