Permalink
Browse files

Android WebView “tel:” links show web page not found - issue fixed

Summary:
Submitting PR #6810 -  Android WebView “tel:” links show web page not found - issue fixed.
'tel:' link web page not loading:
![screenshot_2016-07-01-19-48-05](https://cloud.githubusercontent.com/assets/11989113/16525364/b3e9f10c-3fc9-11e6-8119-93cdf24d54df.png)

After Fixing the issue:
![screenshot_2016-07-01-19-52-00](https://cloud.githubusercontent.com/assets/11989113/16525371/c0d74d92-3fc9-11e6-899b-570a940692f6.png)
Closes #8526

Differential Revision: D3554500

fbshipit-source-id: e8cc1ac4c36ddf0c6b261a29b2e038caddc03e75
  • Loading branch information...
1 parent b06b7ae commit 33a1f28654e24a47d80f6ffc75072d0158085a09 @sathyapriya-31 sathyapriya-31 committed with Facebook Github Bot 0 Jul 13, 2016
@@ -41,6 +41,8 @@
import com.facebook.react.uimanager.annotations.ReactProp;
import com.facebook.react.uimanager.events.Event;
import com.facebook.react.uimanager.events.EventDispatcher;
+import android.content.Intent;
+import android.net.Uri;
/**
* Manages instances of {@link WebView}
@@ -112,6 +114,18 @@ public void onPageStarted(WebView webView, String url, Bitmap favicon) {
}
@Override
+ public boolean shouldOverrideUrlLoading(WebView view, String url) {
+ if (url.startsWith("http://") || url.startsWith("https://")) {
+ return false;
+ } else {
+ Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
+ intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+ view.getContext().startActivity(intent);
+ return true;
+ }
+ }
+
+ @Override
public void onReceivedError(
WebView webView,
int errorCode,

0 comments on commit 33a1f28

Please sign in to comment.