Exported Activity Permission for AppWidget Configuration Activity

北战南征 提交于 2019-12-24 00:32:39

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!