Skip to content

Commit

Permalink
fix: version code compat
Browse files Browse the repository at this point in the history
  • Loading branch information
CraZyLegenD committed Jun 21, 2020
1 parent 6ab5664 commit c468236
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,12 @@ internal object DeviceUtils {
}

private fun getDeviceID(context: Context): String? = Settings.Secure.getString(context.contentResolver, Settings.Secure.ANDROID_ID)
private fun getAppVersion(context: Context) = context.packageManager.getPackageInfo(context.packageName, 0).longVersionCode
private fun getAppVersion(context: Context) = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
context.packageManager.getPackageInfo(context.packageName, 0).longVersionCode
} else {
context.packageManager.getPackageInfo(context.packageName, 0).versionCode.toLong()
}

private fun getLaunchedFromApp(context: Context): String? {
val packageName: String?
val localPackageManager = context.packageManager
Expand Down

0 comments on commit c468236

Please sign in to comment.