Skip to content

Commit

Permalink
Android WebView “tel:” links show web page not found - issue fixed
Browse files Browse the repository at this point in the history
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
sathyapriya-31 authored and Facebook Github Bot 0 committed Jul 13, 2016
1 parent b06b7ae commit 33a1f28
Showing 1 changed file with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down Expand Up @@ -111,6 +113,18 @@ public void onPageStarted(WebView webView, String url, Bitmap favicon) {
createWebViewEvent(webView, url)));
}

@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,
Expand Down

0 comments on commit 33a1f28

Please sign in to comment.