diff options
author | Allan Wang <me@allanwang.ca> | 2017-06-23 14:17:34 -0700 |
---|---|---|
committer | Allan Wang <me@allanwang.ca> | 2017-06-23 14:17:34 -0700 |
commit | 9c081ffbf451eedf40cce28a9768761030bda869 (patch) | |
tree | 96afd50f89214e37dba98c4d6e28786cfcb1de58 /library/src/main/kotlin | |
parent | 96aec553a2ecfc8706d8707dc0fdb502864a5000 (diff) | |
download | kau-9c081ffbf451eedf40cce28a9768761030bda869.tar.gz kau-9c081ffbf451eedf40cce28a9768761030bda869.tar.bz2 kau-9c081ffbf451eedf40cce28a9768761030bda869.zip |
Is from google play
Diffstat (limited to 'library/src/main/kotlin')
-rw-r--r-- | library/src/main/kotlin/ca/allanwang/kau/utils/PackageUtils.kt | 11 |
1 files changed, 9 insertions, 2 deletions
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 |