如何通过Html网页调用本地安卓app?

微信如何通过Html网页调用本地安卓app 或者ios app?

android 端代码




    
        
            
                

                
            
            
                
                
                
                
                
            
        
    

package com.liuan.jsrunapp;

import android.content.Intent;
import android.net.Uri;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {
    TextView mTextView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);


        mTextView = (TextView) findViewById(R.id.tv_main_show);
        Intent intent = getIntent();
        Uri uri = intent.getData();
        if (uri != null) {
            String name = uri.getQueryParameter("name");
            String scheme = uri.getScheme();
            String host = uri.getHost();
            String port = uri.getPort() + "";
            String path = uri.getPath();
            String query = uri.getQuery();
            mTextView.setText("获得的数据name:" + name + "\n" + "scheme:" + scheme + "\n" + "host:" +
                    "host:" + host + "\n" + "port:" + port + "\n" + "path:" + path + "\n" + "query:" + query);

        }
    }
}

Html 代码




webToApp

点我打开

 

你可能感兴趣的:(004html,#,android技术)