1.AndroiManifest.xml中配置

请在App启动的第一个Activity的那个节点中加入

<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:host="arseeds.com"
android:scheme="zhaojian"/>

</intent-filter>

例如我是以GuideActivity为第一个启动的Activity,配置如下

<activity android:name=".base.activity.GuideActivity">   
<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"/>
<category android:name="android.intent.category.DEFAULT"/>
<category android:name="android.intent.category.BROWSABLE"/>
<data android:host="arseeds.com"
android:scheme="zhaojian"/>

</intent-filter>
</activity>

data中的host和scheme可以自定义

2.在浏览器中唤醒APP

需要在第一个启动的Activity中的onCreate中加入

          Intent intent = getIntent();
Uri uri = intent.getData();
if (uri != null) {
String pid = uri.getQueryParameter("pid");
}

pid为自定义链接的参数,如果仅仅只是唤醒APP,就可以忽略此步骤

3.在WebView中的唤醒

需要在WebView中配置

webView.setWebViewClient(new WebViewClient(){ 
@Override public boolean shouldOverrideUrlLoading(WebView view, String url) {
Uri uri=Uri.parse(url);
if(uri.getScheme().equals("zhaojian")&&uri.getHost().equals("arseeds.com")){
String arg0=uri.getQueryParameter("arg0");
String arg1=uri.getQueryParameter("arg1");
}else{
view.loadUrl(url);
} return true;
}});

拿到了参数,剩下的就不用我说了

4.最重要的是在html中的配置

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<a href="zhaojian://arseeds.com/?pid=1">打开app</a><br/>
</body></html>

OK,就这么简单

更多相关文章

  1. java socket参数详解:TcpNoDelay
  2. 在spring 中如何注入map,set,list,property等参数
  3. 如何将动态参数传递给jquery函数
  4. 使用字符串参数调用AndroidJni静态方法。
  5. Java开发水吧点饮品系统(顶层父类对象做接口参数)
  6. java返回值是list的时候获取list的参数类型
  7. Java反射---getGenericSuperclass和ParameterizedType参数化类型
  8. 转发可变数量的参数以通过椭圆运算符接受可变数量的参数
  9. 准备语句SQL异常“无输入参数”

随机推荐

  1. Android签名验证简介
  2. Android(安卓)webview 常用配置
  3. Android原生运行uniapp使用5+app创建项目
  4. Android音频介绍
  5. android sdk content loader 一直显示0%
  6. [android] PhoneGap 在 android 下的实现
  7. 一键解决Ubuntu下安装Eclipse Android/C/
  8. android 中的xml解析
  9. android stuio eclipse映射下的快捷键
  10. Android使用FFmpeg(三)--ffmpeg实现视频