Skip to content

Commit

Permalink
Android: add support for some built-in phone intents (e.g. tel, sms, …
Browse files Browse the repository at this point in the history
…etc)
  • Loading branch information
Andrew He committed Jul 8, 2011
1 parent ccdc6f4 commit 52df3d1
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Android/mopub-android-sdk/src/com/mopub/mobileads/AdView.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,19 @@ public boolean shouldOverrideUrlLoading(WebView view, String url) {
else if (host.equals("custom")) adView.handleCustomIntentFromUri(uri);
return true;
}
// Handle other phone intents.
else if (url.startsWith("tel:") || url.startsWith("voicemail:") ||
url.startsWith("sms:") || url.startsWith("mailto:") ||
url.startsWith("geo:") || url.startsWith("google.streetview:")) {
Intent intent = new Intent(Intent.ACTION_VIEW, Uri.parse(url));
try {
getContext().startActivity(intent);
} catch (ActivityNotFoundException e) {
Log.w("MoPub", "Could not handle intent with URI: " + url +
". Is this intent unsupported on your phone?");
}
return true;
}

String clickthroughUrl = adView.getClickthroughUrl();
if (clickthroughUrl != null) url = clickthroughUrl + "&r=" + Uri.encode(url);
Expand Down

0 comments on commit 52df3d1

Please sign in to comment.