Yusuf I.
—Since Android 12, a requirement for using Activities, Broadcast Receivers, or Services with Intent Filters is to set an exported
attribute in the Android Manifest.
Uploading an APK to the Play Store without setting an exported
attribute might result in an error such as:
You uploaded an APK or Android App Bundle which has an activity, activity alias, service, or broadcast receiver with intent filter, but without the 'android: exported' property set. This file can't be installed on Android 12 or higher.
We’ll go through examples of setting the exported
attribute for Activities, Broadcast Receivers, and Services.
Setting the exported property to true
allows external apps to launch the component while setting it to false
allows only your app to launch the component.
Below is an example of an activity
element with the intent-filter
and the exported
attributes set:
<activity android:name=".MainActivity" android:exported="true" android:theme="@style/Theme.App.Starting"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter>
Activities that implement android.intent.category.LAUNCHER
in an intent-filter
should set exported to true
.
Next, we have an example of a Broadcast Receiver:
<receiver android:name=".ExampleBroadcastReceiver" android:exported="false"> <intent-filter> <action android:name="EXAMPLE_BROADCAST" /> </intent-filter> </receiver>
If the receiver should listen for broadcasts from the system or external apps then set exported
to true
.
Finally, we have an example of a Service:
<service android:name=".MessagingService" android:exported="false"> <intent-filter> <action android:name="com.google.firebase.MESSAGING_EVENT" /> </intent-filter> </service>
As you can see, all three examples implement Intent Filters. You don’t have to set the exported
attribute if you are not using an Intent Filter.
Tasty treats for web developers brought to you by Sentry. Get tips and tricks from Wes Bos and Scott Tolinski.
SEE EPISODESConsidered “not bad” by 4 million developers and more than 100,000 organizations worldwide, Sentry provides code-level observability to many of the world’s best-known companies like Disney, Peloton, Cloudflare, Eventbrite, Slack, Supercell, and Rockstar Games. Each month we process billions of exceptions from the most popular products on the internet.
Here’s a quick look at how Sentry handles your personal information (PII).
×We collect PII about people browsing our website, users of the Sentry service, prospective customers, and people who otherwise interact with us.
What if my PII is included in data sent to Sentry by a Sentry customer (e.g., someone using Sentry to monitor their app)? In this case you have to contact the Sentry customer (e.g., the maker of the app). We do not control the data that is sent to us through the Sentry service for the purposes of application monitoring.
Am I included?We may disclose your PII to the following type of recipients:
You may have the following rights related to your PII:
If you have any questions or concerns about your privacy at Sentry, please email us at compliance@sentry.io.
If you are a California resident, see our Supplemental notice.