Skip to content

Commit

Permalink
fix: getVersionInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
muedsa committed Sep 19, 2024
1 parent 1b9e69b commit 329c8db
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/src/main/kotlin/com/muedsa/uitl/AppUtil.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ object AppUtil {
fun getVersionInfo(context: Context): String {
return try {
val packageInfo = context.packageManager.getPackageInfo(context.packageName, 0)
"${packageInfo.versionName}(${packageInfo.longVersionCode})"
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.P)
"${packageInfo.versionName}(${packageInfo.longVersionCode})"
else
"${packageInfo.versionName}(${packageInfo.versionCode})"
} catch (t: Throwable) {
""
}
Expand Down

0 comments on commit 329c8db

Please sign in to comment.