APP调用评分弹框

1.     在应用内通过Intent打开:

public void startActivity(){ String packageName = "要打开的App的包名";

String uri = String.format("market://woyou.market/appDetail?packageName=%s",packageName);

Intent intent= new Intent(Intent.ACTION_VIEW,Uri.parse(uri));

intent.addCategory(Intent.CATEGORY_DEFAULT);

PackageManager packageManager = getPackageManager();

List activities = packageManager.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY);

    boolean isIntentSafe = activities.size() > 0;

if (isIntentSafe) {

startActivity(intent);

}

 }

 

2.     通过使用webview打开: 在xml中使用< a href=" ">进入应用市场详情页 如果mWebView.setWebViewClient();设置了此函数,则不能通过a链接自动打开,只能通过拦截链接再使用Intent跳转。

mWebView.setWebViewClient(newWebViewClient() {

@Override public boolean shouldOverrideUrlLoading (WebView view, Stringurl){

Log.d(TAG, "shouldOverrideUrlLoading: " + url);

Intent intent = null;

try {

intent = Intent.parseUri(url, Intent.URI_INTENT_SCHEME);

} catch (URISyntaxException e) {

e.printStackTrace();return false;

}

startActivity(intent);

return true;

}

});

 

3.在浏览器打开: 地址:market://woyou.market/appDetail?packageName=包名 注:只能在终端自带浏览器或者Chrome 浏览器打开,其他浏览器均打不开

4.更新 appUpdate market://woyou.market/appUpdate

5.评论 appComment market://woyou.market/appComment?packageName=%s&type=true/false(true主动点击弹出 false 自动弹出) 

String uri = String.format(“market://woyou.market/appComment?packageName=%s&type=%s”,packageName,true);