【发布时间】:2022-11-10 09:37:10
【问题描述】:
我收到了来自 sonarqube 的警告说
对此导出的组件实施权限。
同时,android 文档明确指出任何带有
<intent-filters>的活动都应标记为exported="true"。https://developer.android.com/guide/topics/manifest/activity-element#exported
如果您的应用程序中的活动包含意图过滤器,请将此元素设置为“true”以允许其他应用程序启动它。
例如,如果活动是应用程序的主要活动,并且包含类别“android.intent.category.LAUNCHER”。
如果此元素设置为“false”并且应用程序尝试启动 Activity,则系统会引发 ActivityNotFoundException。这是来自警告中的一些代码AndroidManifest.xml
<activity android:name=".example.WebViewActivity" android:exported="true" android:launchMode="singleTop"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:host="example.com" /> <data android:scheme="http" /> <data android:scheme="https" /> <data android:pathPrefix="/app/Webview" /> </intent-filter> </activity>那么,对于这个问题有什么建议吗?谢谢你
【问题讨论】:
标签: android sonarqube android-manifest