开发者

Android - About opening the Market from an application

In order to tell the user that a new version of an Android application is available, an AlertDialog is displayed asking the user to go on the Market in order to download the latest version.

The code responsible for sending the user to the Market is the following:

Intent intentMarket = new Intent(Intent.ACTION_VIEW, Uri.parse(getString(R.string.app_name)));
mContext.startActivity(intentMarket);

With this approach and given this, the Android Market activity takes the top of the back stack and if the user quits the Market without returning back to the application, when he comes back by clicking on the application icon, he finds himself on the Market and not on the application which can be ambiguous for him.

Is there any solution to this?

开发者_开发问答

Thanks!


You need to set the flag FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET. It's just a matter of:

intentMarket.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜