only use mlkit for playstore installs

This commit is contained in:
andrekir 2022-08-05 00:05:19 -03:00
parent ea0a69524c
commit 0ef0e965dd
2 changed files with 14 additions and 2 deletions

View file

@ -44,6 +44,16 @@ fun Context.hasCompanionDeviceApi(): Boolean =
fun Context.hasGps(): Boolean =
packageManager.hasSystemFeature(PackageManager.FEATURE_LOCATION_GPS)
/**
* return app install source (sideload = null)
*/
fun Context.installSource(): String? {
return if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.R)
packageManager.getInstallSourceInfo(packageName).installingPackageName
else
packageManager.getInstallerPackageName(packageName)
}
/**
* return a list of the permissions we don't have
*/