问题
I'm getting this warning for my AppWidget's configuration activity in the manifest file after I added the android:exported="true"
tag. This is what it looks like...
<activity android:name=".widgets.WidgetConfigurationActivity"
android:theme="@android:style/Theme.Translucent"
android:exported="true" >
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_CONFIGURE" />
</intent-filter>
</activity>
The warning I'm getting is "Exported activity does not require permission". From my understanding, setting the exported
tag to true means that another application not related to my app can access it (which would make sense since the home screen launcher apps needs to launch my AppWidget's configuration activity). Does anyone know what kind of permission I need to add here to make this not give an error?
回答1:
From my understanding, setting the exported tag to true means that another application not related to my app can access it
Correct. Note that it is superfluous here: having an <intent-filter>
makes the activity be exported by default.
Does anyone know what kind of permission I need to add here to make this not give an error?
AFAIK, you cannot guarantee that the home screen has any particular permission.
IMHO, this is an erroneous warning, one that I filed a related issue for that should be fixed someday.
回答2:
You can change the attribute android:exported="true"
to android:exported="false"
.
That should fix the problem for you.
来源:https://stackoverflow.com/questions/11916590/exported-activity-permission-for-appwidget-configuration-activity