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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user