XML/HTML Code復(fù)制內(nèi)容到剪貼板
- <code class="hljs" javascript="">var openApp = function () {
- var btnOpenApp = document.getElementById(open-app);
- btnOpenApp.onclick = function () {
- //打開本地應(yīng)用函數(shù)
- var open=function(url){
- var timeout;
- function try_to_open_app() {
- timeout = setTimeout(function(){
- window.location.href=url;
- console.log()
- }, );
- }
- try_to_open_app();
- }
- if (/android/i.test(navigator.userAgent)) {
- //alert(This is Android'browser.);//這是Android平臺下瀏覽器
- if (/MicroMessenger/i.test(navigator.userAgent)) {
- alert(This is MicroMessenger browser,請使用本地瀏覽器打開);//這是微信平臺下瀏覽器
- }
- else {
- open(andorid應(yīng)用市場url);
- }
- }
- if (/(iPhone|iPad|iPod|iOS)/i.test(navigator.userAgent)) {
- //alert(This is iOS'browser.);//這是iOS平臺下瀏覽器
- if (/MicroMessenger/i.test(navigator.userAgent)) {
- alert(微信內(nèi)置瀏覽器不支持打開本地應(yīng)用,請點擊右上角使用本地瀏覽器打開);//這是微信平臺下瀏覽器
- }
- else {
- open(ios應(yīng)用市場url);
- }
- }
- };
- }</code>
XML/HTML Code復(fù)制內(nèi)容到剪貼板
- <activity android:name=".ui.UploadActivity" android:screenorientation="portrait">
- <intent-filter>
- <data android:scheme="http" android:host="192.168.167.33" android:port="8088" android:path="/mi-tracker-web/download.html">
- <action android:name="android.intent.action.VIEW">
- <category android:name="android.intent.category.DEFAULT">
- <category android:name="android.intent.category.BROWSABLE">
- </category></category></action></data></intent-filter>
- </activity>
XML/HTML Code復(fù)制內(nèi)容到剪貼板
- <%@ page language="java" contentType="text/html; charset=ISO-8859-1"
- pageEncoding="ISO-8859-1"%>
- <script type="text/javascript"> window.location="market://search?q=com.singtel.travelbuddy.android";</script>
- String str = "market://details?id=" + getPackageName();
- Intent localIntent = new Intent("android.intent.action.VIEW");
- localIntent.setData(Uri.parse(str));
- startActivity(localIntent);
XML/HTML Code復(fù)制內(nèi)容到剪貼板
- Uri uri = getIntent().getData(); String test1= uri.getQueryParameter("arg0"); String test2= uri.getQueryParameter("arg1");
- webView.setWebViewClient(new WebViewClient(){
- @Override
- public boolean shouldOverrideUrlLoading(WebView view, String url) {
- Uri uri=Uri.parse(url);
- if(uri.getScheme().equals("m")&&uri.getHost().equals("my.com")){
- String arg=uri.getQueryParameter("arg");
- String arg=uri.getQueryParameter("arg");
- }else{
- view.loadUrl(url);
- }
- return true;
- }
- });
以上所述是小編給大家介紹的Android本地應(yīng)用打開方法——通過html5寫連接 ,希望對大家有所幫助!