blackfyre blackfyre - 1 year ago 137
Android Question

How to set permissions in broadcast sender and receiver in android

How do we specify in broadcast sending application that which application can receive this broadcast, and in receiving application that which particular application has the permission to send broadcast to its broadcast receiver...

I am new to android..I read the documentation etc on internet but couldn't find the syntax to specify these permissions.

Answer Source

use an intent filter in receiver tag in manifest

    android:name="Your receiver"
    android:exported="false" >
        <action android:name="action"/>
        <category android:name="category" />

To send broadcast to app

   Intent intent = new Intent();
   intent.setAction("use same action in receiver");
   intent.addcategory("use same category in receiver");
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download