[TIMOB-28475] Android: Add "android:exported" attribute to all activities/services that have an intent-filter
| GitHub Issue | n/a |
|---|---|
| Type | Improvement |
| Priority | Critical |
| Status | Closed |
| Resolution | Fixed |
| Resolution Date | 2021-08-02T17:15:45.000+0000 |
| Affected Version/s | n/a |
| Fix Version/s | Release 10.1.0 |
| Components | Android |
| Labels | activity, android, broadcastReceiver, build, exports, intent-filter, manifest, service |
| Reporter | Joshua Quick |
| Assignee | Joshua Quick |
| Created | 2021-06-05T04:58:08.000+0000 |
| Updated | 2021-08-02T17:15:58.000+0000 |
Description
*Summary:*
When targeting Android 12 (aka: API Level 31), all activities, services, and broadcast receivers that have an
<intent-filter/> defined must also explicitly define an android:exported attribute or else the build will fail. This is a breaking-change made by Google.
https://developer.android.com/about/versions/12/behavior-changes-12#exported
The following error will be logged...
Apps targeting Android 12 and higher are required to specify an explicit value for android:exported when the corresponding component has an intent filter defined.
*To-Do:*
Set exported to false for the below Titanium SDK [AndroidManifest.xml](https://github.com/appcelerator/titanium_mobile/blob/master/android/titanium/AndroidManifest.xml) activities.
* org.appcelerator.titanium.TiActivity
* org.appcelerator.titanium.TiTranslucentActivity
* ti.modules.titanium.media.TiCameraActivity
* ti.modules.titanium.media.TiVideoActivity
* ti.modules.titanium.ui.android.TiPreferencesActivity
Set exported to true for SDK test app's main activity in [AndroidManifest.xml](https://github.com/appcelerator/titanium_mobile/blob/master/android/app/src/main/AndroidManifest.xml).
Set exported to true for app template's main activity in [AndroidManifest.xml](https://github.com/appcelerator/titanium_mobile/blob/master/android/templates/build/AndroidManifest.xml).
PR (master): https://github.com/appcelerator/titanium_mobile/pull/12881
FR Passed.