Last active
August 29, 2015 14:10
-
-
Save TakWolf/25fe11faa734297ff3dd to your computer and use it in GitHub Desktop.
Android跳转到应用市场的详细信息页面,可以用于实现应用评分或者推荐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
//参考链接: | |
//http://stackoverflow.com/questions/4702204/android-market-detailsid-not-working-for-app | |
... | |
//这里开始执行一个应用市场跳转逻辑,默认this为Context上下文对象 | |
Intent intent = new Intent(Intent.ACTION_VIEW); | |
intent.setData(Uri.parse("market://details?id=" + getPackageName())); //跳转到应用市场,非Google Play市场一般情况也实现了这个接口 | |
//存在手机里没安装应用市场的情况,跳转会包异常,做一个接收判断 | |
if (intent.resolveActivity(getPackageManager()) != null) { //可以接收 | |
startActivity(intent); | |
} else { | |
Toast.makeText(this, "您的系统中没有安装应用市场", Toast.LENGTH_SHORT).show(); | |
} | |
/*根据以上,同理使用以下Uri进行替换: | |
Uri.parse("market://search?q=pub:Author Name"); //跳转到商店搜索界面,并搜索开发者姓名 | |
Uri.parse("market://search?q=Keyword"); //跳转到商店搜索界面,并搜索关键词 | |
*/ | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment