Android 12 updates

* Updated gradle version and dependencies
* Bumped compileSdkVersion and targetSdkVersion to 31
* Added support for updates without user action
* Bumped versionCode and versionName

Changes required by API level 31:
 * Added explicit exported tags to activities and receivers
 * Added explicit IMMUTABLE|MUTABLE flags to PendingIntents
This commit is contained in:
Oliver Scott
2021-11-10 15:14:05 -05:00
parent 934a96fb11
commit f83d26df58
8 changed files with 60 additions and 23 deletions

View File

@@ -96,11 +96,13 @@ fun <T> Context.open(className: Class<T>, newTask: Boolean = false) {
}
fun Context.restartApp() {
val flags = if (isMAndAbove()) PendingIntent.FLAG_CANCEL_CURRENT or PendingIntent.FLAG_IMMUTABLE
else PendingIntent.FLAG_CANCEL_CURRENT
val pendingIntent = PendingIntent.getActivity(
this,
1337,
Intent(this, MainActivity::class.java),
PendingIntent.FLAG_CANCEL_CURRENT
flags
)
val alarmManager = getSystemService(Context.ALARM_SERVICE) as AlarmManager