在调用的app里面添加一个button按钮并注册事件
public void btn_Click(View view) { //加载本地网页 webView.loadUrl("file:///android_asset/index.html"); } index.html如下:
<!DOCTYPE html> <html> <head> <title>浏览器总启动本地 activity</title> <meta charset="utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> </head> <body> <a href="myapp://jp.app/openwith">授权并登录</a><br><br> </body> </html> 调用的app的清单文件:<intent-filter> <action android:name="android.intent.action.VIEW"/> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="myapp" android:host="jp.app" android:pathPrefix="/openwith"/> </intent-filter>这里面必须清楚一点是:href="由scheme+host+pathPrefix"组成