Ionicプラグインinappbrowser内のH 5はどのようにアンドロイドappを開きます


一、プロジェクトにrunまたはbuildがある場合:
1、オープン/platforms/android/src/org/apache/cordova/inappbrowser/InAppBrowser.java
2、shouldOverrideUrlLoading関数を見つけて、次のように置き換えます.

@Override
public boolean shouldOverrideUrlLoading(WebView webView, String url) {
    if (url.startsWith(WebView.SCHEME_TEL)) {
        try {
            Intent intent = new Intent(Intent.ACTION_DIAL);
            intent.setData(Uri.parse(url));
            cordova.getActivity().startActivity(intent);
            return true;
        } catch (android.content.ActivityNotFoundException e) {
            LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString());
        }
    }
    //    if    intent 
    else if (url.startsWith("geo:") || url.startsWith(WebView.SCHEME_MAILTO) || url.startsWith("market:")) {
        try {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(url));
            cordova.getActivity().startActivity(intent);
            return true;
        } catch (android.content.ActivityNotFoundException e) {
            LOG.e(LOG_TAG, "Error with " + url + ": " + e.toString());
        }
    }
    else if (url.startsWith("sms:")) {
        try {
            Intent intent = new Intent(Intent.ACTION_VIEW);

            // Get address
            String address = null;
            int parmIndex = url.indexOf('?');
            if (parmIndex == -1) {
                address = url.substring(4);
            } else {
                address = url.substring(4, parmIndex);

                // If body, then set sms body
                Uri uri = Uri.parse(url);
                String query = uri.getQuery();
                if (query != null) {
                    if (query.startsWith("body=")) {
                        intent.putExtra("sms_body", query.substring(5));
                    }
                }
            }
            intent.setData(Uri.parse("sms:" + address));
            intent.putExtra("address", address);
            intent.setType("vnd.android-dir/mms-sms");
            cordova.getActivity().startActivity(intent);
            return true;
        } catch (android.content.ActivityNotFoundException e) {
            LOG.e(LOG_TAG, "Error sending sms " + url + ":" + e.toString());
        }
    }
    else {    //      ,         ,            scheme  
        try {
            Intent intent = new Intent(Intent.ACTION_VIEW);
            intent.setData(Uri.parse(url));
            cordova.getActivity().startActivity(intent);
            return true;
        } catch (android.content.ActivityNotFoundException e) {
            LOG.e(LOG_TAG, "Error with " + url + ": " + e.toString());
        }
    }
    return false;
}

それからrunかbuildをもう一度すればいいです.
二、runやbuildがない場合
1.オープン/plugins/cordova-plugin-inappbrowser/src/android/InAppBrowser.java
2、shouldOverrideUrlLoading関数を上記のコードに置き換えればよい.