Here is my manifest file with my background service declaration
......
<service android:name="com.example.MyService"
android:process=":service"
android:permission="android.permission.BIND_VPN_SERVICE">
<intent-filter>
<action android:name="com.example.START_MY_SERVICE" />
</intent-filter>
......
- What should a 3rd party app declare in its manifest which is interested in binding with my service ?
- Also how does the verification of the permission( or custom defined permission) happens in my app when the 3rd party app tries to bind to my service ?
First, do not use separate processes without a very good reason.
Second, do not re-use Android standard permissions for your own purposes, unless those purposes are really closely tied to what Android secures with that permission. You should only be requiring
BIND_VPN_SERVICE
if your app will be doing VPN-related stuff, such as binding the VPN on the caller's behalf.That is handled automatically for you by Android when somebody calls
startService()
orbindService()
with anIntent
that identifies your service. If the caller does not hold the permission listed inandroid:permission
, they will get aSecurityException
.