From 36e90c9e222e7ecec80ca3d5413bc8814b5eb58b Mon Sep 17 00:00:00 2001 From: Joe Bowser Date: Mon, 26 Apr 2010 10:44:13 -0700 Subject: [PATCH] Adding sms:// to DroidGap, not quite working, since it doesn't pre-populate the number --- framework/src/com/phonegap/DroidGap.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/framework/src/com/phonegap/DroidGap.java b/framework/src/com/phonegap/DroidGap.java index 4c8c3c81..6c46ac3b 100644 --- a/framework/src/com/phonegap/DroidGap.java +++ b/framework/src/com/phonegap/DroidGap.java @@ -182,14 +182,13 @@ public class DroidGap extends Activity { * @see android.webkit.WebViewClient#shouldOverrideUrlLoading(android.webkit.WebView, java.lang.String) * * Note: Since we override it to make sure that we are using PhoneGap and not some other bullshit - * viewer that may or may not exist, we need to make sure that http:// and tel:// still work. We - * plan to add sms:// and gap:// to make this more compatible with the iPhone, but for right now - * we're fixing what we're breaking. + * viewer that may or may not exist, we need to make sure that http:// and tel:// still work. * */ @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { + // TODO: See about using a switch statement if (url.startsWith("http://")) { Intent browse = new Intent(Intent.ACTION_VIEW, Uri.parse(url)); @@ -202,6 +201,14 @@ public class DroidGap extends Activity { startActivity(dial); return true; } + else if(url.startsWith("sms:")) + { + Uri smsUri = Uri.parse(url); + Intent intent = new Intent(Intent.ACTION_VIEW, smsUri); + intent.setType("vnd.android-dir/mms-sms"); + startActivity(intent); + return true; + } else { view.loadUrl(url);