Android之从Browser中打开本地的应用程序&微信检测是否有对应app
16lz
2021-12-04
在对应的应用程序的AndroidManifest.xml中配置:
<activity android:name=".ui.TabHostActivity" android:windowSoftInputMode="stateHidden|stateAlwaysHidden|adjustPan" android:launchMode="singleTop" android:screenOrientation="nosensor" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <!-- --> <action android:name="android.intent.action.VIEW"></action> <category android:name="android.intent.category.DEFAULT"></category> <category android:name="android.intent.category.BROWSABLE"></category> <data android:host="www.kuyue.com" android:scheme="kuyue"></data> <!-- --> </intent-filter> </activity>
网页代码:
<a href="kuyue://www.kuyue.com">open</a>
1 .MAC终端查看本机ip: ifconfig | grep inet 2 . 终端下开一个简单服务器,适用于mac: python -m SimpleHTTPServer 可以把带有上面网页代码的Html放进一个文件中,再在终端定位到该文件夹,输入2的命令开一个简单的服务器用于测试,测试的时候记住第三方的浏览器有可能不能正确调用本地程序,请用android自带浏览器进行设置。
*** 颜色的代码都可以自定义,但必须是一一对应的。
微信检测:
微信在打开网页的时候会在你的正确地址后面加上带一个isappinstalled=1 (1是表示有该应用,0表示没有 可能 没有也会没有这个参数)
更多相关文章
- Android版本号对应API、版本名称、NDK版本等
- gradle 配置文件 build.gradle 属性详解
- 阻止android软键盘自动弹出
- Android版本和API Level对应关系
- android之应用程序退到android桌面的实现
- android自带的drawable图标ico名称对应表
- android process bar 几种style
- Android实现九宫格
- android makefile prebuild