From 9c081ffbf451eedf40cce28a9768761030bda869 Mon Sep 17 00:00:00 2001 From: Allan Wang Date: Fri, 23 Jun 2017 14:17:34 -0700 Subject: Is from google play --- .../src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'library/src/main/kotlin') diff --git a/library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt b/library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt index 99e5ace..646c0dd 100644 --- a/library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt +++ b/library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt @@ -31,7 +31,14 @@ val buildIsLollipopAndUp: Boolean val buildIsMarshmallowAndUp: Boolean get() = Build.VERSION.SDK_INT >= Build.VERSION_CODES.M -const val KAU_GOOGLE_PLAY_INSTALLER = "com.android.vending" +const val INSTALLER_GOOGLE_PLAY_VENDING = "com.android.vending" +const val INSTALLER_GOOGLE_PLAY_FEEDBACK = "com.google.android.feedback" val Context.installerPackageName: String? - get() = packageManager.getInstallerPackageName(packageName) \ No newline at end of file + get() = packageManager.getInstallerPackageName(packageName) + +val Context.isFromGooglePlay: Boolean + get() { + val installer = installerPackageName + return arrayOf(INSTALLER_GOOGLE_PLAY_FEEDBACK, INSTALLER_GOOGLE_PLAY_VENDING).any { it == installer } + } \ No newline at end of file -- cgit v1.2.3