Skip to content

Commit ebf6342

Browse files
authored
LP-11310 - add google play url support in web interstitials (#395)
1 parent 152517e commit ebf6342

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

AndroidSDKCore/src/main/java/com/leanplum/messagetemplates/BaseMessageDialog.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,16 @@
2424
import android.annotation.SuppressLint;
2525
import android.app.Activity;
2626
import android.app.Dialog;
27+
import android.content.ActivityNotFoundException;
2728
import android.content.Context;
29+
import android.content.Intent;
2830
import android.graphics.Color;
2931
import android.graphics.Point;
3032
import android.graphics.Typeface;
3133
import android.graphics.drawable.ShapeDrawable;
3234
import android.graphics.drawable.shapes.RoundRectShape;
3335
import android.graphics.drawable.shapes.Shape;
36+
import android.net.Uri;
3437
import android.os.Build;
3538
import android.os.Handler;
3639
import android.text.Layout;
@@ -456,6 +459,20 @@ public boolean shouldOverrideUrlLoading(WebView wView, String url) {
456459
}
457460
return true;
458461
}
462+
463+
// handle Google Play URI
464+
Uri uri = Uri.parse(url);
465+
if ("market".equals(uri.getScheme())) {
466+
try {
467+
Intent intent = new Intent(Intent.ACTION_VIEW);
468+
intent.setData(uri);
469+
wView.getContext().startActivity(intent);
470+
return true;
471+
} catch (ActivityNotFoundException e) {
472+
// Missing Google Play
473+
return false;
474+
}
475+
}
459476
return false;
460477
}
461478
});

0 commit comments

Comments
 (0)