[TIMOB-28476] Android: Add PendingIntent constants FLAG_IMMUTABLE and FLAG_MUTABLE
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Medium |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-08-25T15:29:31.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 10.1.0 |
| Components | Android |
| Labels | android, intent, pendingintent |
| Reporter | Joshua Quick |
| Assignee | Gary Mathews |
| Created | 2021-06-07T23:11:14.000+0000 |
| Updated | 2021-08-25T15:29:31.000+0000 |
Description
*Summary:*
When targeting Android 12 (aka: API Level 31), you must provide either a [FLAG_IMMUTABLE](https://developer.android.com/reference/android/app/PendingIntent#FLAG_IMMUTABLE) or [FLAG_MUTABLE](https://developer.android.com/reference/android/app/PendingIntent#FLAG_MUTABLE) when creating/getting a
PendingIntent or else an exception will be thrown. This is a breaking-change made by Google.
https://developer.android.com/about/versions/12/behavior-changes-12#pending-intent-mutability
*To-Do:*
Add the following constants to Titanium.
* Ti.Android.FLAG_IMMUTABLE
* Ti.Android.FLAG_MUTABLE
When calling [Ti.Android.createPendingIntent()](https://developer.android.com/reference/android/app/PendingIntent#FLAG_MUTABLE), Titanium should automatically assign it the FLAG_IMMUTABLE constant unless the caller sets the FLAG_MUTABLE explicitly.
master: https://github.com/appcelerator/titanium_mobile/pull/12890