You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2013/06/28 18:00:46 UTC

[26/50] [abbrv] android commit: CB-3902: Explicitly add market URIs to CordovaWebViewClient so this always works, not just sometimes

CB-3902: Explicitly add market URIs to CordovaWebViewClient so this always works, not just sometimes


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

Branch: refs/heads/2.9.x
Commit: 98b971b4dec0df8315a0ec6513146c46ce6dbb4a
Parents: 4ec3d6d
Author: Joe Bowser <bo...@apache.org>
Authored: Tue Jun 18 16:19:27 2013 -0700
Committer: Joe Bowser <bo...@apache.org>
Committed: Tue Jun 18 16:20:14 2013 -0700

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaWebViewClient.java     | 11 +++++++++++
 1 file changed, 11 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/98b971b4/framework/src/org/apache/cordova/CordovaWebViewClient.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebViewClient.java b/framework/src/org/apache/cordova/CordovaWebViewClient.java
index eef961c..c49611e 100755
--- a/framework/src/org/apache/cordova/CordovaWebViewClient.java
+++ b/framework/src/org/apache/cordova/CordovaWebViewClient.java
@@ -188,6 +188,17 @@ public class CordovaWebViewClient extends WebViewClient {
                 LOG.e(TAG, "Error sending sms " + url + ":" + e.toString());
             }
         }
+        
+        //Android Market
+        else if(url.startsWith("market:")) {
+            try {
+                Intent intent = new Intent(Intent.ACTION_VIEW);
+                intent.setData(Uri.parse(url));
+                this.cordova.getActivity().startActivity(intent);
+            } catch (android.content.ActivityNotFoundException e) {
+                LOG.e(TAG, "Error loading Google Play Store: " + url, e);
+            }
+        }
 
         // All else
         else {