如何设置广播发送者和接收者的Andr​​oid权限 [英] How to set permissions in broadcast sender and receiver in android

查看:103
本文介绍了如何设置广播发送者和接收者的Andr​​oid权限的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们如何在广播发送指定的应用程序,该应用程序可以收到此广播,并在收到申请的哪一个特定的应用程序需要发送广播的广播接收器...

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...

我是新来的android..I阅读在互联网上的文件等,但无法找到指定这些权限的语法。

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

推荐答案

使用接收器标签的意图过滤器清单中

use an intent filter in receiver tag in manifest

 <receiver
    android:name="Your receiver"
    android:enabled="true"
    android:exported="false" >
    <intent-filter>
        <action android:name="action"/>
        <category android:name="category" />
    </intent-filter>
</receiver>

要发送广播应用

   Intent intent = new Intent();
   intent.setAction("use same action in receiver");
   intent.addcategory("use same category in receiver");
   context.sendBroadcast(intent); 

这篇关于如何设置广播发送者和接收者的Andr​​oid权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆