Android本地应用打开方法――通过html5写连接
1、在html中设置链接
复制代码代码如下:
href=”[scheme]://[host]/[path]?[query]”
scheme可以自己在app内部设置成任意的,把android和ios的设置成一样的
2、若本地应用存在,直接打开app;若不存在,计时一段时间跳到appstore
需要判断ios还是android平台下的浏览器,需要判断微信浏览器
Android配置
XML/HTML Code 复制内容到剪贴板 <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 >Open Application
XML/HTML Code 复制内容到剪贴板 <%@ 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);HTML配置示例
Open app
Open Market
Open Market Details
Android获取参数:
以上所述是小编给大家介绍的Android本地应用打开方法——通过html5写连接 ,希望对大家有所帮助!
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。