Skip to content

Commit 893aac5

Browse files
committed
Fix build version
1 parent fe39738 commit 893aac5

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

firebase-sessions/src/main/kotlin/com/google/firebase/sessions/SessionEvents.kt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,12 @@ internal object SessionEvents {
128128
val context = firebaseApp.applicationContext
129129
val packageName = context.packageName
130130
val packageInfo = context.packageManager.getPackageInfo(packageName, 0)
131+
val buildVersion =
132+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
133+
packageInfo.longVersionCode
134+
} else {
135+
@Suppress("DEPRECATION") packageInfo.versionCode
136+
}
131137

132138
return ApplicationInfo(
133139
appId = firebaseApp.options.applicationId,
@@ -139,7 +145,7 @@ internal object SessionEvents {
139145
AndroidApplicationInfo(
140146
packageName = packageName,
141147
versionName = packageInfo.versionName,
142-
appBuildVersion = packageInfo.versionCode.toString(),
148+
appBuildVersion = buildVersion.toString(),
143149
deviceManufacturer = Build.MANUFACTURER,
144150
)
145151
)

0 commit comments

Comments
 (0)