I am trying to launch an Android app from a URI using this SO question as a reference.
I have a manifest file with the following declared activity:
<activity android:name=".MainActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" android:host="example.com" />
</intent-filter>
</activity>
I am attempting to launch MainActivity with the http://example.com link. My issue is that I get the warning
"exported activity does not require permission"
I have looked at other SO questions that report this same warning and all solutions don't seem to work.
How do I write the activity intent-filter correctly to avoid the warning?
Thanks
I had the same issue when I updated SDK to version 20. I removed it adding android:exported propery:
<activity
android:name=".MainActivity"
android:exported="false">
<intent-filter>
<action android:name="android.intent.action.VIEW" />
<data android:scheme="http" android:host="example.com" />
</intent-filter>
</activity>
inside the activity declaration in manifest. Of course you may specify this if the activity is intended only for application-internal use
The reason it fixes it is found on docs:
android:exported:The default value depends on whether the activity contains intent filters. The absence of any filters means that the activity can be invoked only by specifying its exact class name. This implies that the activity is intended only for application-internal use (since others would not know the class name). So in this case, the default value is "false". On the other hand, the presence of at least one filter implies that the activity is intended for external use, so the default value is "true".
Since "Exported receiver does not require permission" (at least the LINT message is clear) ,you got it.
Did you try to clean your project (Project > Clean ...) ? It fixed this warning for my project, maybe yours.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With