Skip to content

Commit 66528a8

Browse files
Use PackageManagerCompat for instant app detection
1 parent 125bf0e commit 66528a8

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

app/src/main/java/com/d4rk/androidtutorials/java/ui/components/navigation/BottomSheetMenuFragment.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,14 @@ public View onCreateView(@NonNull LayoutInflater inflater,
6262
sharingIntent.setType("text/plain");
6363

6464
String shareLink;
65-
if (InstantApps.isInstantApp(requireContext())) {
65+
boolean isInstant = InstantApps
66+
.getPackageManagerCompat(requireContext())
67+
.isInstantApp();
68+
if (isInstant) {
6669
shareLink = "https://example.com/instant";
6770
} else {
68-
shareLink = "https://play.google.com/store/apps/details?id=" + BuildConfig.APPLICATION_ID;
71+
shareLink = "https://play.google.com/store/apps/details?id="
72+
+ BuildConfig.APPLICATION_ID;
6973
}
7074

7175
String shareMessage = getString(R.string.share_message, shareLink);

0 commit comments

Comments
 (0)