I have a service which both downloads a file and saves it, and it seems I can only specify one permission.
<service android:enabled="true"
android:name=".DownloadService" android:permission="android.permission.INTERNET">
</service>
or
<service android:enabled="true"
android:name=".DownloadService" android:permission="android.permission.WRITE_EXTERNAL_STORAGE">
</service>
I need both.
An Android
Service
can have multiple permissions, but permissions are granted at the application level, not at theService
level.Your problem is that you are trying to grant permission to your
Service
in the wrong place in theAndroidManifest.xml
file.The
android:permission
attribute of aService
specifies the permission that an entity must have to use the service, not a permission granted to theService
.You grant permissions to all components your application at the top level of your
AndroidManifest.xml
: