Nik
Nik

Reputation: 7214

Permission usage in Android

I need to be shure, that only my app can broadcasts intents to my IntentService. How do I make it using Android Permissions?

I see similar permission usage in gcm android library, but I not understand how it works.

Upvotes: 0

Views: 147

Answers (2)

vipsy
vipsy

Reputation: 427

If you want that any of your own app can use this service (multiple apps) but other can not, you will need to implement signature based permissions.

Declare your own custom signature permission

<permission android:description="string resource"
android:icon="drawable resource"
android:label="string resource"
android:name="string"
android:permissionGroup="string"
android:protectionLevel="signature" />

Then enforce this permission in your BroadcaseReceiver using

android:permission="string"  

tag in your receiver or even you can do that in any other component like activity, etc.

Then in your other app which wants to access above feature, can declare using-permission in its manifest. Remember : your second app must be signed by same certificate to use your custom signature based permission. Read more about permissions here : http://developer.android.com/guide/topics/security/permissions.html

Upvotes: 3

CSmith
CSmith

Reputation: 13458

Please refer to:

http://developer.android.com/guide/components/services.html

If you plan on using your service only locally (other applications do not use it), then you don't need to (and should not) supply any intent filters. Without any intent filters, you must start the service using an intent that explicitly names the service class.

Just don't put any Intent filters in your manifest...

Upvotes: 0

Related Questions