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 2014/08/14 23:21:15 UTC

[07/10] android commit: CB-7265 Fix crash when navigating to custom protocol (introduced in 3.5.1)

CB-7265 Fix crash when navigating to custom protocol (introduced in 3.5.1)

Conflicts:
	framework/src/org/apache/cordova/CordovaUriHelper.java

Github: close #111


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

Branch: refs/heads/4.0.x
Commit: 73219bf2d22a7057f19b6dd9cd8fd24632316d90
Parents: d6eb723
Author: Martin Bektchiev <ma...@telerik.com>
Authored: Wed Aug 6 15:24:51 2014 +0300
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Aug 7 09:58:40 2014 -0400

----------------------------------------------------------------------
 framework/src/org/apache/cordova/CordovaUriHelper.java | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/73219bf2/framework/src/org/apache/cordova/CordovaUriHelper.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaUriHelper.java b/framework/src/org/apache/cordova/CordovaUriHelper.java
index dcbaeb5..bb78592 100644
--- a/framework/src/org/apache/cordova/CordovaUriHelper.java
+++ b/framework/src/org/apache/cordova/CordovaUriHelper.java
@@ -19,8 +19,10 @@
 
 package org.apache.cordova;
 
+import android.annotation.TargetApi;
 import android.content.Intent;
 import android.net.Uri;
+import android.os.Build;
 import android.webkit.WebView;
 
 class CordovaUriHelper {
@@ -44,6 +46,7 @@ class CordovaUriHelper {
      * @param url           The url to be loaded.
      * @return              true to override, false for default behavior
      */
+    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1)
     boolean shouldOverrideUrlLoading(WebView view, String url) {
         // The WebView should support http and https when going on the Internet
         if(url.startsWith("http:") || url.startsWith("https:"))
@@ -71,7 +74,9 @@ class CordovaUriHelper {
                 intent.setData(Uri.parse(url));
                 intent.addCategory(Intent.CATEGORY_BROWSABLE);
                 intent.setComponent(null);
-                intent.setSelector(null);
+                if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH_MR1) {
+                    intent.setSelector(null);
+                }
                 this.cordova.getActivity().startActivity(intent);
             } catch (android.content.ActivityNotFoundException e) {
                 LOG.e(TAG, "Error loading url " + url, e);