h5唤醒app

    最近公司有个需求要在h5页面能跳转到银行app。这也是我第一次接触这样的业务,因而一开始碰到很多的困难,还好后面也解决了。

h5页面跳转app,一般通过URL Scheme进行跳转。

1、URL Scheme是什么?

我们先看下url的组成:

[scheme:][//authority][path][?query][#fragment]

例如百度网址:http:www.baidu.com,scheme就是http

微信的scheme为weixin:// ,那么跳到微信app可以如下:

微信

倘若想跳转到具体的某个页面,可以在sheme后面增加host或者path

     行为(应用的某个功能)    
            |
scheme://[path][?query]
   |               |
应用标识       功能需要的参数

APP常见的url scheme:

APP 微信 支付宝 淘宝 微博 qq 知乎 短信
URL Scheme weixin:// alipay:// taobao:// sinaweibo:// mqq:// zhihu:// sms://

2、如何找url scheme?

找url scheme的方法有很多,我采用的是下载app 的apk,从apk中获取相关的信息。

1)下载app的apk

2)通过apkdb工具反编译apk

apkdb工具下载地址:链接:https://pan.baidu.com/s/1cF-MO1Z1hJWrFqowRltQsQ      提取码:0ozq 

3)将反编译过来的apk的文件夹中打开Manifest.xml文件,一般信息配置都在这文件里。

3、具体如何实现唤醒app,点击链接:

https://github.com/linying1223/h5CallApp
 

附注:根据此次需求收集到的sheme有:

[
	{
      "bank":"工商银行",
      "scheme":"com.icbc.iphoneclient",
      "package": "com.icbc",
      "androidHostOrPath": '',
      "androidScheme": "com.icbc.androidclient"
      
    },
    {
      "bank":"农业银行",
      "scheme":"bankabc",
      "package": "com.android.bankabc",
      "androidHostOrPath": '',
      "androidScheme": "bankabc"
    },
    {
        "bank":"中国银行",
        "scheme":"bocmbcizf",
        "package": "com.chinamworld.bocmbci",
        "androidHostOrPath": 'h5',
        "androidScheme": "bocmbciphone"
    },
    {
        "bank":"建设银行",
        "scheme":"ccbmobilebank",
        "package": "com.chinamworld.main",
        "androidHostOrPath": "main.ccb.com",
        "androidScheme": "ccbapp"
    },
    { 
        "bank":"交通银行",
        "scheme":"wx862767be0919d45a",
        "package": "com.bankcomm.Bankcomm",
        "androidHostOrPath": "",
        "androidScheme": "bocom"
    },
    {
        "bank":"民生银行",
        "scheme":"com.cmbc.cn.iphone",
        "package": "cn.com.cmbc.newmbank",
        "androidHostOrPath": "qd.mbank",
        "androidScheme": "cmbc"
    },
    {
        "bank":"中信银行",
        "scheme":"citic",
        "package": "com.ecitic.bank.mobile",
        "androidHostOrPath": "splashActivity",
        "androidScheme": "wakeupciticmobilebank"
    },
    {
        "bank":"浦发银行",
        "scheme":"wx1cb534bb13ba3dbd",
        "package": "cn.com.spdb.mobilebank.per",
        "androidHostOrPath": "wap.spdb.com.cn",
        "androidScheme": "spdbbank"
    },
    {
        "bank":"兴业银行",
        "scheme":"cibmb",
        "package": "com.cib.cibmb", 
        "androidHostOrPath": "",
        "androidScheme": "cibmb"
    },
    {
        "bank":"招商银行",
        "scheme":"cmbmobilebank",
        "package": "cmb.pb",
        "androidHostOrPath": "",
        "androidScheme": "cmbmobilebank"
    },
    {
        "bank":"广发银行",
        "scheme":"wb801126555",
        "package": "com.cgbchina.xpt",
        "androidHostOrPath": "lua",
        "androidScheme": "cgb"
    },
    {
        "bank":"光大银行",
        "scheme":"wxf505f9da589b9506",
        "package": "com.cebbank.mobile.cemb",
        "androidHostOrPath": "mobile",
        "androidScheme": "cebbank"
    },
    {
        "bank":"华夏银行",
        "scheme":"com.hx.hxbank",
        "package": "com.rytong.app.bankhx",
        "androidHostOrPath": "hxb.com.cn",
        "androidScheme": "com.hx.hxbank"
    },
    {
        "bank":"渤海银行",
        "scheme":"wxcc0b1c78c5bebdb5",
        "package": "cn.com.bhbc.mobilebank.per",
        "androidHostOrPath": "",
        "androidScheme": "tencent100371282"
    },
    {
        "bank":"天津银行",
        "scheme":"wx1683cc7279171014",
        "package": "com.csii.tianjin.mobilebank",
        "androidHostOrPath": "",
        "androidScheme": "tencent1105300754"
    },
    {
        "bank":"恒丰银行",
        "scheme":"egbank",
        "package": "com.rytong.egfbank",
        "androidHostOrPath": "",
        "androidScheme": "egbank"
    },
    {
        "bank":"浙商银行",
        "scheme":"wx105bde8d0d9f2372",
        "package": "com.czbank.mbank"
    },
    {
        "bank":"平安银行",
        "scheme":"paebqw",
        "package": "com.pingan.paces.ccms",
        "androidHostOrPath": "anydoor",
        "androidScheme": "com.pingan.paces.ccms"
    },
    {
        "bank":"江苏银行",
        "scheme":"jsbsjyh",
        "package": "cn.jsb.china",
        "androidHostOrPath": "mbank.jsbchina.sjyh",
        "androidScheme": "jsbsjyh"
    },
    {
        "bank":"北京银行",
        "scheme":"wxb57101c34cb7773e",
        "package": "com.rytong.bankbj",
        "androidHostOrPath": "beijing.rytong.com",
        "androidScheme": "jingcai"
    },
    {
        "bank":"上海银行",
        "scheme":"bankofshanghai",
        "package": "cn.com.shbank.mper",
        "androidHostOrPath": "BankOfShangHai.com",
        "androidScheme": "mobile"
    },
    {
        "bank":"河北银行",
        "scheme":"hebbank",
        "package": "com.rytong.bankbhb",
        "androidHostOrPath": "mobile.com",
        "androidScheme": "hebbank"
    },
    {
        "bank":"青岛银行",
        "scheme":"wxe63b95c397856088",
        "package": "com.rytong.bankqd"
    },
    {
        "bank":"齐鲁银行",
        "scheme":"wx66b04eb340cefc57",
        "package": "com.iss.qilubank",
        "androidHostOrPath": "",
        "androidScheme": "sccba866"
    },
    {
        "bank":"日照银行",
        "scheme":"sccba810",
        "package": "com.iss.rizhaobank"
    },
    {
        "bank":"莱商银行",
        "scheme":"sccba803",
        "package": "com.iss.laishangbank",
        "androidHostOrPath": "",
        "androidScheme": "sccba803"
    },
    {
        "bank":"潍坊银行",
        "scheme":"wx4df61036a188951c",
        "package": "com.iss.weifangbank"
    },
    {
        "bank":"济宁银行",
        "scheme":"wx46071b807d2f473c",
        "package": "com.iss.jiningbank",
        "androidHostOrPath": "",
        "androidScheme": "sccba815"
    },
    {
        "bank":"东营银行",
        "scheme":"wb4216759672",
        "package": "com.iss.dongyingbank",
        "androidHostOrPath": "",
        "androidScheme": "sccba812"
    },
    {
        "bank":"烟台银行",
        "scheme":"sccba816",
        "package": "com.iss.yantaibank",
        "androidHostOrPath": "",
        "androidScheme": "sccba816"
    },
    {
        "bank":"威海银行",
        "scheme":"wx14cd9621b76ffa2f",
        "package": "com.pafinancialtech.weihaibank",
        "androidHostOrPath": "",
        "androidScheme": "tencent1104918647"
    },
    {
        "bank":"枣庄银行",
        "scheme":"sccba808",
        "package": "com.iss.zaozhuangbank",
        "androidHostOrPath": "",
        "androidScheme": "sccba808"
    },
    {
        "bank":"泰安银行",
        "scheme":"wb3819898473",
        "package": "com.iss.taianbank",
        "androidHostOrPath": "",
        "androidScheme": "sccba811"
    },
    {
        "bank":"中国邮储银行",
        "scheme":"psbcmbank", 
        "package": "com.yitong.mbank.psbc",
        "androidHostOrPath": "mainpage",
        "androidScheme": "psbc"
    },
    {
        "bank":"杭州银行",
        "scheme":"com.hzbank.hzbank.per",
        "package": "cn.com.hzb.mobilebank.per",
        "androidHostOrPath": "",
        "androidScheme": "hzbper"
    }
]

 

你可能感兴趣的:(个人,javaScript)