You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by bo...@apache.org on 2013/02/15 22:58:16 UTC

android commit: CB-2446: Ugly, but workable fix

Updated Branches:
  refs/heads/master 8613551ae -> c20b2330a


CB-2446: Ugly, but workable fix


Project: http://git-wip-us.apache.org/repos/asf/cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-android/commit/c20b2330
Tree: http://git-wip-us.apache.org/repos/asf/cordova-android/tree/c20b2330
Diff: http://git-wip-us.apache.org/repos/asf/cordova-android/diff/c20b2330

Branch: refs/heads/master
Commit: c20b2330ab3d1a147dd829014480432e1cb12260
Parents: 8613551
Author: Joe Bowser <bo...@apache.org>
Authored: Fri Feb 15 13:57:34 2013 -0800
Committer: Joe Bowser <bo...@apache.org>
Committed: Fri Feb 15 13:57:34 2013 -0800

----------------------------------------------------------------------
 framework/src/org/apache/cordova/InAppBrowser.java |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/c20b2330/framework/src/org/apache/cordova/InAppBrowser.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/InAppBrowser.java b/framework/src/org/apache/cordova/InAppBrowser.java
index 0d83432..0b5246e 100644
--- a/framework/src/org/apache/cordova/InAppBrowser.java
+++ b/framework/src/org/apache/cordova/InAppBrowser.java
@@ -23,6 +23,7 @@ import java.util.StringTokenizer;
 
 import org.apache.cordova.api.CallbackContext;
 import org.apache.cordova.api.CordovaPlugin;
+import org.apache.cordova.api.LOG;
 import org.apache.cordova.api.PluginResult;
 import org.json.JSONArray;
 import org.json.JSONException;
@@ -108,6 +109,17 @@ public class InAppBrowser extends CordovaPlugin {
                             || Config.isUrlWhiteListed(url)) {
                         this.webView.loadUrl(url);
                     }
+                    //Load the dialer
+                    else if (url.startsWith(WebView.SCHEME_TEL))
+                    {
+                        try {
+                            Intent intent = new Intent(Intent.ACTION_DIAL);
+                            intent.setData(Uri.parse(url));
+                            this.cordova.getActivity().startActivity(intent);
+                        } catch (android.content.ActivityNotFoundException e) {
+                            LOG.e(LOG_TAG, "Error dialing " + url + ": " + e.toString());
+                        }
+                    }
                     // load in InAppBrowser
                     else {
                         result = this.showWebPage(url, features);