Android 应用中跳转到应用市场评分示例
发布时间:2020-10-06 22:00:15
来源:脚本之家
阅读:97
作者:听话哥
在开发Android App过程中,经常会遇见这样的功能。从当前的app跳转到一个应用商店并且跳转到自己app的详情页面,让用户给自己的App进行评分、评价,从而提高自己App的排名。下面介绍三种方法实现该功能。
方法一:通过系统隐式意图方式去调用应用市场app详情页
try{
Uri uri = Uri.parse("market://details?id="+getPackageName());
Intent intent = new Intent(Intent.ACTION_VIEW,uri);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent);
}catch(Exception e){
Toast.makeText(MainActivity.this, "您的手机没有安装Android应用市场", Toast.LENGTH_SHORT).show();
e.printStackTrace();
}
方法二:通过应用市场的搜索方法来调用app详情页
try {
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("market://search?q="+getPackagename())