Answer: Note: only applicable for the portrait screen devices with a version of 3.5 or above in App market
special codes please refer to the chinese page
1. Enable it in App via Internet:
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. Enable it via webview:
在xml中使用进入应用市场详情页
如果mWebView.setWebViewClient();设置了此函数,则不能通过a链接自动打开,只能通过拦截链接再使用Intent跳转。
mWebView.setWebViewClient(new WebViewClient(){
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
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. Enable it in the browser:
Address: :market://woyou.market/appDetail?packageName=包名
Note: you can only enable it in the built-in browser of the terminal or in Chrome browser, you cannot enable it in all other browsers