引用:http://www.dewen.org/q/9646
- Intent browserIntent =newIntent(Intent.ACTION_VIEW,Uri.parse("https://play.google.com/store/apps/details?id=com.imangi.templerun"));
- browserIntent.setClassName("com.android.vending","com.android.vending.AssetBrowserActivity");
- browserIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
- startActivity(browserIntent);
- https://play.google.com/store/apps/details?id=com.imangi.templerun
引用:http://www.eoeandroid.com/thread-243220-1-1.html
webView.setWebViewClient(new WebViewClient(){ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { PackageManager pm = HtmlIntro.this.getPackageManager(); ArrayList<PackageInfo> list = (ArrayList<PackageInfo>) pm.getInstalledPackages(PackageManager.GET_ACTIVITIES); for(int i = 0;i<list.size();i++) { //会打印出手机里安装的所有的程序的包名 if (list.get(i).packageName.equals("com.android.vending")) { url = url.substring(url.lastIndexOf("id=")+3); Uri uri = Uri.parse("market://search?q="+ url); Intent it = new Intent(Intent.ACTION_VIEW,uri); startActivity(it); return true; } } Intent viewIntent = new Intent(Intent.ACTION_VIEW , Uri.parse(url)); startActivity(viewIntent); return true;//super.shouldOverrideUrlLoading(view, url) } }); |
引用:http://blog.csdn.net/feng88724/article/details/6606464
在实际需求,有可能会有给应用评价这样的功能,通常这样的功能都会跳转到Android Market来让用户评论。 (自己服务器上的数据,总是不那么可信嘛,对吧)
那么如何进入自己应用的评价页面呢?
1. 网页版
通过网页进入自己应用。比如,你的应用名叫: 苏州实时交通 包名为: com.yfz.bus
那只要通过下面的URL即可进入:
"https://market.android.com/details?id" + <package>;
搜索某个应用时可以用下面这个:
"https://market.android.com/search?q" + <package>;
或者"https://market.android.com/search?q" + <应用名>;
比如: https://market.android.com/details?id=苏州实时交通
代码:
- <span style="font-family:'Microsoft YaHei';"> Uri uri = Uri.parse("https://market.android.com/details?id=com.yfz.bus");
- Intent intent=new Intent(Intent.ACTION_VIEW, uri);
- startActivity(intent);</span>
2. Market手机应用版
同样是通过URL,只是格式有点区别, 如下:
搜索: " market://search?q=pname: " + <package>;
详细: "market://details?id= " + <package>;
代码一样,就不罗嗦了。
引用:http://blog.csdn.net/icephone/article/details/6775804
- * market://search?q=pname:<package>
- */
- private void startSearchPNAMEIntent(){
- String pkgname;
- if(mEditText != null){
- pkgname = mEditText.getText().toString();
- }else{
- return;
- }
- Uri uri = Uri.parse("market://search?q=pname:"+pkgname);
- Intent it = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(it);
- }
- /**
- * market://search?q=pnames:<package>
- */
- private void startSearchPNAMESIntent(){
- String pkgnames;
- if(mEditText != null){
- pkgnames = mEditText.getText().toString();
- }else{
- return;
- }
- Uri uri = Uri.parse("market://search?q=pnames:"+pkgnames);
- Intent it = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(it);
- }
- /**
- * market://search?q=pub:Your Publisher Name
- */
- private void startSearchPUBIntent(){
- String pub;
- if(mEditText != null){
- pub = mEditText.getText().toString();
- }else{
- return;
- }
- Uri uri = Uri.parse("market://search?q=pub:"+pub);
- Intent it = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(it);
- }
- /**
- * market://details?id=<package_name>
- */
- private void startSearchIDIntent(){
- String id;
- if(mEditText != null){
- id = mEditText.getText().toString();
- }else{
- return;
- }
- Uri uri = Uri.parse("market://search?id="+id);
- Intent it = new Intent(Intent.ACTION_VIEW, uri);
- startActivity(it);
- }