Android网页链接打开本地app

1.在清单文件中添加过滤


            
                

                

                

                
                

                
            
        

2.准备.html点击事件




  
  Insert title here


打开app

3.接收传参

Intent intent = getIntent();
        if (intent != null) {
            String act = intent.getAction();
            if (Intent.ACTION_VIEW.equals(act)) {
                Uri uri = intent.getData();
                if (uri != null) {
                    String host = uri.getHost();
                    String queryString = uri.getQuery();
                    Log.e("enenennenen:", host + "");
                    Log.e("enenennenen:", queryString + "");

                    String test1 = uri.getQueryParameter("name");
                    String test2 = uri.getQueryParameter("age");
                    Log.e("enenennenen:", test1 + "");
                    Log.e("enenennenen:", test2 + "");
                }
            }
        }

你可能感兴趣的:(Android网页链接打开本地app)