Skip to content
Permalink
Browse files

Use PackageInfoCompat.getLongVersionCode

  • Loading branch information...
ianhanniballake committed Oct 7, 2019
1 parent ff48f44 commit c68aadd8ba6672024064ad6063027d6b3f5dd24c
@@ -9,6 +9,7 @@ import android.net.Uri
import android.os.Build
import android.util.Log
import androidx.core.content.edit
import androidx.core.content.pm.PackageInfoCompat
import androidx.lifecycle.DefaultLifecycleObserver
import androidx.lifecycle.LifecycleOwner
import androidx.preference.PreferenceManager
@@ -44,12 +45,7 @@ class WorkManagerInitializer : ContentProvider() {
sharedPreferences.edit {
putLong(KEY_RESET_VERSION_CODE, context.packageManager.getPackageInfo(context
.packageName, 0)?.run {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
longVersionCode
} else {
@Suppress("DEPRECATION")
versionCode.toLong()
}
PackageInfoCompat.getLongVersionCode(this)
} ?: 0L)
}
if (BuildConfig.DEBUG) {

0 comments on commit c68aadd

Please sign in to comment.
You can’t perform that action at this time.