打开谷歌剧中饰演一个新的应用 [英] Open Google play as a new application
问题描述
目前,我正在打开谷歌玩就是描述很多地方的方式:通过启动一个新的意图在市场上的指点下,如下所述:
<一个href=\"http://stackoverflow.com/questions/10922762/open-link-of-google-play-store-in-mobile-version-android\">open移动版本的Android谷歌 Play商店的链接
但是,离开了市场开放,如果用户不点击后退按钮,并再次对我的应用程序的图标,而不是点击。
有没有一种简单的方法,迫使谷歌发挥自己的应用程序加载,而不是作为对矿井之上的新的活动?
公共无效goToMarket(){
URI URI = Uri.parse(市场://详细信息的id =+ getPackageName());
意图goToMarket =新意图(Intent.ACTION_VIEW,URI);
goToMarket.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
尝试{
startActivity(goToMarket);
}赶上(ActivityNotFoundException E){
Toast.makeText(这一点,getResources()的getString(R.string.errorLaunchMarket),Toast.LENGTH_LONG。).show();
}
}
如前所述,你可以添加 Intent.FLAG_ACTIVITY_NEW_TASK
你的 setFlags()
。
I'm currently opening Google Play the way that is described many places: by starting a new intent pointing at the market, as described here:
open link of google play store in mobile version android
But that leaves the market open if the user doesn't hit the back button, and instead clicks on my app's icon again.
Is there an easy way to force Google Play to load in its own application, instead of as a new Activity on top of mine?
public void goToMarket(){
Uri uri = Uri.parse("market://details?id=" + getPackageName());
Intent goToMarket = new Intent(Intent.ACTION_VIEW, uri);
goToMarket.setFlags(Intent.FLAG_ACTIVITY_NO_HISTORY | Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
try {
startActivity(goToMarket);
} catch (ActivityNotFoundException e) {
Toast.makeText(this, getResources().getString(R.string.errorLaunchMarket), Toast.LENGTH_LONG).show();
}
}
As stated you could add the Intent.FLAG_ACTIVITY_NEW_TASK
to your setFlags()
.
这篇关于打开谷歌剧中饰演一个新的应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!