Skip to content

Commit

Permalink
actions: less warnings is more (fixes #3775) (#3782)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
ewhang5 and dogi authored Jul 9, 2024
1 parent 50195c5 commit 9f2da9c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ android {
applicationId "org.ole.planet.myplanet"
minSdkVersion 21
targetSdkVersion 34
versionCode 1664
versionName "0.16.64"
versionCode 1665
versionName "0.16.65"
ndkVersion '21.3.6528147'
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
vectorDrawables.useSupportLibrary = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,21 @@ package org.ole.planet.myplanet.utilities

import android.content.Context
import android.content.pm.PackageManager
import android.os.Build
import android.provider.Settings
import androidx.core.content.pm.PackageInfoCompat.getLongVersionCode

object VersionUtils {
@JvmStatic
fun getVersionCode(context: Context): Int {
try {
val pInfo = context.packageManager.getPackageInfo(context.packageName, 0)
return pInfo.versionCode
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
return getLongVersionCode(pInfo).toInt()
} else {
@Suppress("DEPRECATION")
return pInfo.versionCode
}
} catch (e: PackageManager.NameNotFoundException) {
e.printStackTrace()
}
Expand Down

0 comments on commit 9f2da9c

Please sign in to comment.