您的位置:首页 > 移动开发 > Android开发

Android 浏览器自定义scheme:market://协议

2013-09-09 20:24 369 查看
目前的浏览器中,自定义schemed的有UC,还有FireFox。大部分的浏览器没做这个点,因为这个点实际使用的时候确实意义不大。

原生的android 浏览器要做自定义sheme,要处理2个问题,一个就是在url的地址栏中输入类似:market://details?id=com.tencent.mobileqq 这样的链接,然后就可以调起系统中的应用市场,比如Google play,豌豆家。。。等。还有就是当在网页中点击这样的链接的时候,也可以有同样的效果。

具体的不多说了,保留一些有用的链接如下:

1.百度测试market协议的链接,挺好

http://appstest.baidu.com/market/index.xhtml

2.第一个看到有关于market协议的资料

http://zhanhao.iteye.com/blog/1415462

3.Google的官方文档,不是很全

http://developer.android.com/distribute/googleplay/promote/linking.html#android-app

4.基础,有必要看看
http://blog.csdn.net/dyllove98/article/details/9968751 http://www.eoeandroid.com/forum.php?mod=viewthread&tid=234813
http://stackoverflow.com/questions/10316944/accurate-market-search-via-intent

http://stackoverflow.com/questions/3133650/android-intent-to-open-users-preferred-browser

http://bbs.gfan.com/forum.php?mod=viewthread&tid=349494

http://moto0421.iteye.com/blog/1030350

http://blog.csdn.net/hundsong/article/details/6623500

http://developer.android.com/guide/topics/manifest/data-element.html#mime

details

market://details?id=com.tencent.mobileqq

http://market
http://market.android.com/details?id=com.tencent.mobileqq
http://bbs.gfan.com/forum.php?mod=viewthread&tid=349494

market://search

market://search?q=pname:com.tencent.mobileqq

market://search?q=pname:com.skyd.luckywheel

market://details?id=com.skyd.luckywheel
http://blog.moa.cse.tw/2012/05/androidandroid-app-openurl.html http://www.dotblogs.com.tw/pou/archive/2012/01/01/64089.aspx
下面是测试的时候用的:

// -------------
//            String url = null;
//            final String myaction = intent.getAction();
//            if (Intent.ACTION_SEARCH.equals(myaction)) {
//                url = intent.getStringExtra(SearchManager.QUERY);
//                Log.i("tag", "url = " + intent.getStringExtra(SearchManager.QUERY));
//
//                if (url.contains("market")) {
//                    Log.i("tag", "xxx   url contains market");
//                    // 测试跳到APP详情页面
//                  Intent intent3 =  new Intent();
//                  intent3.setAction(Intent.ACTION_VIEW);
//                  // Make sure the intent goes to the Browser itself
//                  intent3.setPackage(mActivity.getPackageName());
//                  intent3.addCategory(Intent.CATEGORY_DEFAULT);
//    //              String url = "market://details?id=com.tencent.mobileqq";
//                  Uri uri3 = Uri.parse(url);
//                  intent3.setData(uri3);
//    //              intent3.setClassName("com.xiaomi.market", "com.xiaomi.market.ui.AppDetailActivity");
//                  mActivity.startActivity(intent3);
//                  return;
//                }
//            }

Log.i("tag", "3333333  url = " + url.toString());
if (url.contains("market")) {
Log.i("tag", "url contains market");
// 测试跳到APP详情页面
Intent intent3 =  new Intent();
intent3.setAction(Intent.ACTION_VIEW);
Uri uri3 = Uri.parse(url);
intent3.setData(uri3);
//          intent3.setClassName("com.xiaomi.market", "com.xiaomi.market.ui.AppDetailActivity");
activity.startActivity(intent3);
return false;
}


// 测试跳到APP详情页面
//              Intent intent3 =  new Intent();
//              intent3.setAction(Intent.ACTION_VIEW);
//              String url = "market://details?id=com.tencent.mobileqq";
//              Uri uri3 = Uri.parse(url);
//              intent3.setData(uri3);
//              intent3.setClassName("com.xiaomi.market", "com.xiaomi.market.ui.AppDetailActivity");
//              mActivity.startActivity(intent3);

// 测试跳到APP搜索结果页面
//              Intent intent2 =  new Intent();
//              intent2.setAction(Intent.ACTION_VIEW);
//              String url = "market://search?q=pname:com.tencent.mobileqq";
//              Uri uri3 = Uri.parse(url);
//              intent2.setData(uri3);
//              intent2.setClassName("com.xiaomi.market", "com.xiaomi.market.ui.JoinActivity");
//              mActivity.startActivity(intent2);

 

 

http://www.riaspace.com/2011/08/defining-custom-url-schemes-for-your-air-mobile-applications/

https://docs.google.com/document/d/1H255a9QacH06Z9-239xAOEixbR967RmLu7-o0siRaJg/edit?pli=1

https://groups.google.com/forum/#!topic/android-developers/-hkq8-S5-Gs

http://bbs.9ria.com/thread-153303-1-1.html

http://www.pocketdigi.com/20101002/117.html

http://stackoverflow.com/questions/7876163/custom-url-scheme-android

http://code.google.com/p/oauth-php/issues/detail?id=55

http://blog.csdn.net/favormm/article/details/6623490

http://www.bangchui.org/read.php?tid=41179

http://www.blogjava.net/Inn-Gry/archive/2011/10/07/360135.html

https://support.tapatalk.com/threads/implement-intent-filters-and-custom-url-schemes.17100/

http://comments.gmane.org/gmane.comp.handhelds.android.devel/152369

https://begood.good.com/thread/4113

https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014956126

http://developer.appcelerator.com/question/120393/custom-url-scheme---iphone--android

http://blog.csdn.net/hundsong/article/details/6614764

http://www.dotblogs.com.tw/pou/archive/2012/01/01/64089.aspx

http://www.bjguahao.gov.cn/comm/content.php?hpid=113&keid=1030001&haoscore=web&getyear=2013&getmonth=10

 
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: