Skip to content

Commit

Permalink
fix: guard getLongVersionCode API in FlutterJNI (#18)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel committed Jun 16, 2023
1 parent fb1f794 commit 3bbe077
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,11 @@ public void init(
PackageInfo packageInfo =
context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
version = packageInfo.versionName;
versionCode = packageInfo.getLongVersionCode();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
versionCode = packageInfo.getLongVersionCode();
} else {
versionCode = packageInfo.versionCode;
}
} catch (PackageManager.NameNotFoundException e) {
Log.e(TAG, "Failed to read app version. Shorebird updater can't run.", e);
}
Expand Down

0 comments on commit 3bbe077

Please sign in to comment.