android2.21 BroadCastReceiver接收不到数据,什么原因

手把手教你学Android应用开发教程――第九章 BroadcastReceiver的使用_百度文库
两大类热门资源免费畅读
续费一年阅读会员,立省24元!
文档贡献者
评价文档:
手把手教你学Android应用开发教程――第九章 BroadcastReceiver的使用
《​A​n​d​r​o​i​d​应​用​开​发​教​程​》​教​材​简​介​:​(​加​A​n​d​r​o​i​d​学​习​群​:8962 ​ ​可​免​费​下​载​)​
​该​教​材​由​倚​动​实​验​室​历​经年​多​时​间​编​写​而​成​,​由​江​西​高​校​出​版​社​出​版​。​倚​动​实​验​室​由​博​士​生​导​师​钟​元​生​教​授​牵​头​,​一​批​硕​、​博​士​研​究​生​合​作​建​设​,​专​注​于​手​机​编​程​课​的​教​学​研​究​、​资​源​开​发​、​技​术​服​务​和​学​术​交​流
大小:2.35MB
登录百度文库,专享文档复制特权,财富值每天免费拿!
你可能喜欢您所在的位置: &
1.3.3 广播接收器(BroadcastReceiver)
1.3.3 广播接收器(BroadcastReceiver)
机械工业出版社
《Android深入浅出:Android4.x 技术详解与进阶实践》第1章Android应用开发概述,本章是全书最基础的部分,简要介绍Android平台的历史及现状等内容。本节为大家介绍广播接收器(BroadcastReceiver)。
1.3.3&广播接收器(BroadcastReceiver)
BroadcastReceiver同样也是Android系统中的一个重要组件,BroadcastReceiver代表了一个广播接收器,用于接收系统中其它组件发送的广播,并对其进行响应或是拦截广播的继续传播。
广播是一个系统级的消息,当系统环境发生改变的时候会发送一些广播供对应的程序进行接收响应,例如:接收到一条短信、开机、关机、插上充电器、插上耳机、充电完成等,均会发送一条广播供需要监听此类广播的应用进行响应。除了一些系统事件的广播,开发人员也可以自定义广播内容。但是大部分情况下,开发应用的时候主要用于接受系统广播并对其进行响应,很少需要发送自定义的广播。
使用BroadcastReceiver组件接收广播非常的简单,只需要实现自己的BroadcastReceiver子类,并重写onReceive()方法,就能完成BroadcastReceiver,而对于这个BroadcastReceiver对什么广播感兴趣,则需要对其进行另行配置。
&【责任编辑: TEL:(010)】&&&&&&
关于&&的更多文章
本书主要是写给对Android感兴趣的初级开发人员,为了使他们能够
本书描述了黑客用默默无闻的行动为数字世界照亮了一条道路的故事。
本书是根据俾斯麦本人以及他的朋友、对手和共事者的回
杰奎琳作为美国第35任总统――肯尼迪的夫人,她以对时
“出世有正见,入世有正行,正己能自省。”在当下中国
信息安全风险评估理论研究日趋成熟,相关资料比较充分,但有关评估实际工作的参考资料很少。本书以信息安全风险评估实践为基础,
51CTO旗下网站&&&&&&正文
Android 发送和接收自定义广播
摘要:Android 发送和接收自定义广播
android系统会发送许多系统级别的广播,比如屏幕关闭,电池电量低等广播。同样应用可以发起自定义“由开发者定义的”广播。广播是从一个应用内部向另一个应用发送消息的途径之一。是一个可以监听和响应广播的组件。本文中,我们将会演示如何发送自定义广播以及如何通过编程和使用Manifest文件定义一个BroadcastReceiver来监听这一广播。目标:环境与工具:( 1 )创建布局UI01&LinearLayout xmlns:android=&&02 & &xmlns:tools=&&03 & &android:layout_width=&match_parent&04 & &android:layout_height=&match_parent&05 & &android:paddingBottom=&@dimen/activity_vertical_margin&06 & &android:paddingLeft=&@dimen/activity_horizontal_margin&07 & &android:paddingRight=&@dimen/activity_horizontal_margin&08 & &android:paddingTop=&@dimen/activity_vertical_margin&09 & &android:orientation=&vertical&10 & &tools:context=&.MainActivity& &11 12 & &&TextView13 & & & &android:layout_width=&wrap_content&14 & & & &android:layout_height=&wrap_content&15 & & & &android:gravity=&center_horizontal&16 & & & &android:layout_gravity=&center_horizontal&17 & & & &android:text=&Received Broadcasts& /&18 & &&Button19 & & & &android:id=&@+id/btnSendBroadcast&20 & & & &android:layout_width=&wrap_content&21 & & & &android:layout_height=&wrap_content&22 & & & &android:gravity=&center_horizontal&23 & & & &android:layout_gravity=&center_horizontal&24 & & & &android:text=&Send Broadcast&25 & & & &/&26 & &&EditText27 & & & &android:id=&@+id/etReceivedBroadcast&28 & & & &android:layout_width=&match_parent&29 & & & &android:layout_height=&wrap_content&30 31 & & & &/&32 33&/LinearLayout&( 2 ) 扩展 BroadcastReceiver01package com.hmkcode.02 03import android.content.BroadcastR04import android.content.C05import android.content.I06 07public class MyReceiver extends BroadcastReceiver{08 09 & &@Override10 & &public void onReceive(Context context, Intent intent) {11 & & & & MainActivity mainActivity = ((MyApplication) context.getApplicationContext()).mainA12 & & & & mainActivity.etReceivedBroadcast.append(&broadcast: &+intent.getAction()+&n&);13 & &}14 & & 15}( 3 ) 发送广播Intent i = new Intent("com.hmkcode.android.USER_ACTION");
sendBroadcast(i);( 4 ) 通过Java或XML方式注册BroadcastReceiver你可以通过java代码动态注册或在Manifest xml文件中进行注册。@Override
protected void onResume() {
super.onResume();
registerReceiver(new MyReceiver(),
new IntentFilter("com.hmkcode.android.USER_ACTION"));
}1&receiver android:name=&com.hmkcode.android.MyReceiver& &2 & &&intent-filter&3 & & & &&action android:name=&com.hmkcode.android.USER_ACTION& /&4 & &&/intent-filter&5&/receiver&( 5 ) Activity Class01package com.hmkcode.02 03import android.os.B04import android.app.A05import android.content.I06import android.content.IntentF07import android.view.V08import android.view.View.OnClickL09import android.widget.B10import android.widget.EditT11 12 13public class MainActivity extends Activity implements OnClickListener {14 15 & &MyReceiver myR16 & &IntentFilter intentF17 & &EditText etReceivedB18 & &Button btnSendB19 & &@Override20 & &protected void onCreate(Bundle savedInstanceState) {21 & & & &super.onCreate(savedInstanceState);22 & & & &setContentView(R.layout.activity_main);23 & & & & 24 & & & &etReceivedBroadcast = (EditText) findViewById(R.id.etReceivedBroadcast);25 & & & &btnSendBroadcast = (Button) findViewById(R.id.btnSendBroadcast);26 & & & & 27 & & & &28 & & & &MyApplication myApplication = (MyApplication) this.getApplicationContext();29 & & & &myApplication.mainActivity = this;30 31 & & & &btnSendBroadcast.setOnClickListener(this);32 & & & & 33 & & & &myReceiver = new MyReceiver();34 & & & &intentFilter = new IntentFilter(&com.hmkcode.android.USER_ACTION&);35 & &}36 37 & &@Override38 & &protected void onResume() {39 & & & &super.onResume();40 & & & &registerReceiver(myReceiver, intentFilter);41 42 & &}43 & &@Override44 & &protected void onPause() {45 & & & &super.onPause();46 & & & &unregisterReceiver(myReceiver);47 & &}48 & & 49 & & 50 & &@Override51 & &public void onClick(View view) {52 & & & & 53 & & & &Intent intnet = new Intent(&com.hmkcode.android.USER_ACTION&);54 & & & &sendBroadcast(intnet);55 & & 56 & &}57 & & 58}( 6 ) Manifest.XML01&?xml version=&1.0& encoding=&utf-8&?&02&manifest xmlns:android=&&03 & &package=&com.hmkcode.android&04 & &android:versionCode=&1&05 & &android:versionName=&1.0& &06 07 & &&uses-sdk08 & & & &android:minSdkVersion=&8&09 & & & &android:targetSdkVersion=&17& /&10 11 & &&application12 & & & &android:name=&com.hmkcode.android.MyApplication&13 & & & &android:allowBackup=&true&14 & & & &android:icon=&@drawable/ic_launcher&15 & & & &android:label=&@string/app_name&16 & & & &android:theme=&@style/AppTheme& &17 & & & &&activity18 & & & & & &android:name=&com.hmkcode.android.MainActivity&19 & & & & & &android:label=&@string/app_name& &20 & & & & & &&intent-filter&21 & & & & & & & &&action android:name=&android.intent.action.MAIN& /&22 23 & & & & & & & &&category android:name=&android.intent.category.LAUNCHER& /&24 & & & & & &&/intent-filter&25 & & & &&/activity&26 & & & & 27 & & & &&receiver android:name=&com.hmkcode.android.MyReceiver& &28 & & & & & &&intent-filter&29 & & & & & & & &&action android:name=&com.hmkcode.android.USER_ACTION& /&30 & & & & & &&/intent-filter&31 & & & &&/receiver&32 & & & & 33 & &&/application&34 35&/manifest&注:如果你想通过Manifest XML文件注册接收器,那么需要从MainActivity类中移除onResume和onPause方法。( 7 ) 获取Activity Context 的办法当使用xml注册接收器时,系统将ReceiverResctrictredContext传递给onReceive()方法。为了能在EditText中进行打印,需要获取MainActivity context,因此需要通过扩展Application来持有MainActivity的引用。01package com.hmkcode.02 03import android.app.A04 05public class MyApplication extends Application {06 07 & &@Override08 & &public void onCreate() {09 & & & &super.onCreate();10 & &}11 & & 12 & &MainActivity mainA13 & & 14}注意:我们在Manifest文件中使用了MyApplication。&application
android:name="com.hmkcode.android.MyApplication"
全国校区查询
技术分享点击榜
Android中对/data/data//files下文件的读写操作
技术分享最新文章
官方新版意见收集
*您的积极反馈是我们前进的动力
官方新版意见收集
提交成功,感谢您的反馈。
我们会认真阅读和考虑每个用户的反馈。&&&&&&&&&&&&&&&&&&
阅读排行榜
import android.content.BroadcastR import android.content.C import android.content.I import android.os.B import android.telephony.SmsM import android.util.L & public class ReceivingSMSReceiver extends BroadcastReceiver { &&& private static final String SMS_RECEIVED = "android.provider.Telephony.SMS_RECEIVED"; &&& private static final String TAG = "ReceivingSMSReceiver"; & &&& @Override &&& public void onReceive(Context context, Intent intent) { &&&&&& if (intent.getAction().equals(SMS_RECEIVED)) { &&&&&&&&&& Bundle bundle = intent.getExtras(); &&&&&&&&&& if (bundle != null) { &&&&&&&&&&&&& Object[] pdus = (Object[]) bundle.get("pdus"); &&&&&&&&&&&&& SmsMessage[] messages = new SmsMessage[pdus.length]; &&&&&&&&&&&&& for (int i = 0; i & pdus.length; i++) &&&&&&&&&&&&&&&&& messages[i] = SmsMessage.createFromPdu((byte[]) pdus[i]); &&&&&&&&&&&&& for (SmsMessage message : messages) { &&&&&&&&&&&&&&&&& String msg = message.getMessageBody(); &&&&&&&&&&&&&&&&& Log.i(TAG, msg); &&&&&&&&&&&&&&&&& String to = message.getOriginatingAddress(); &&&&&&&&&&&&&&&&& Log.i(TAG, to); &&&&&&&&&&&&& } &&&&&&&&&& } &&&&&& } &&& } } &
ReceivingSMSReceiver
& import android.app.A import android.app.PendingI import android.content.BroadcastR import android.content.C import android.content.I import android.content.IntentF import android.os.B import android.telephony.SmsM import android.view.V import android.widget.B import android.widget.EditText; import android.widget.T & public class SMSSender extends Activity { &&& private static final String TAG = "SMSSender"; &&& Button send = null; &&& EditText address = null; &&& EditText content = null; &&& private mServiceReceiver mReceiver01, mReceiver02; &&& private static String SEND_ACTIOIN = "SMS_SEND_ACTION"; &&& private static String DELIVERED_ACTION = "SMS_DELIVERED_ACTION"; & &&& @Override &&& protected void onCreate(Bundle savedInstanceState) { &&&&&& super.onCreate(savedInstanceState); &&&&&& setContentView(R.layout.main); &&&&&& address = (EditText) findViewById(R.id.address); &&&&&& content = (EditText) findViewById(R.id.content); &&&&&& send = (Button) findViewById(R.id.send); &&&&&& send.setOnClickListener(new View.OnClickListener() { & &&&&&&&&&& @Override &&&&&&&&&& public void onClick(View v) { &&&&&&&&&&&&& // TODO Auto-generated method stub &&&&&&&&&&&&& String mAddress = address.getText().toString().trim(); &&&&&&&&&&&&& String mContent = content.getText().toString().trim(); &&&&&&&&&&&&& if ("".equals(mAddress) || "".equals(mContent)) { &&&&&&&&&&&&&&&&& Toast.makeText(SMSSender.this, "发送地址为空或内容为空!", &&&&&&&&&&&&&&&&&&&& &&& Toast.LENGTH_LONG).show(); &&&&&&&&&&&&&&&&& return; &&&&&&&&&&&&& } &&&&&&&&&&&&& SmsManager smsManager = SmsManager.getDefault(); &&&&&&&&&&&&& try { &&&&&&&&&&&&&&&&& Intent send_Intent = new Intent(SEND_ACTIOIN); &&&&&&&&&&&&&&&&& Intent deliver_Intent = new Intent(DELIVERED_ACTION); &&&&&&&&&&&&&&&&& PendingIntent mSend = PendingIntent.getBroadcast( &&&&&&&&&&&&&&&&&&&&&&&& getApplicationContext(), 0, send_Intent, 0); &&&&&&&&&&&&&&&&& PendingIntent mDeliver = PendingIntent.getBroadcast( &&&&&&&&&&&&&&&&&&&&&&&& getApplicationContext(), 0, deliver_Intent, 0); &&&&&&&&&&&&&&&&& smsManager.sendTextMessage(mAddress, null, mContent, mSend, &&&&&&&&&&&&&&&&&&&& &&& mDeliver); &&&&&&&&&&&&& } catch (Exception e) { &&&&&&&&&&&&&&&&& e.printStackTrace(); &&&&&&&&&&&&& } &&&&&&&&&& } &&&&&& }); &&& } & &&& @Override &&& protected void onResume() { &&&&&& // TODO Auto-generated method stub &&&&&& IntentFilter mFilter01; &&&&&& mFilter01 = new IntentFilter(SEND_ACTIOIN); &&&&&& mReceiver01 = new mServiceReceiver(); &&&&&& registerReceiver(mReceiver01, mFilter01); &&&&&& mFilter01 = new IntentFilter(DELIVERED_ACTION); &&&&&& mReceiver02 = new mServiceReceiver(); &&&&&& registerReceiver(mReceiver02, mFilter01); &&&&&& super.onResume(); &&& } & &&& @Override &&& protected void onPause() { &&&&&& // TODO Auto-generated method stub &&&&&& unregisterReceiver(mReceiver01); &&&&&& unregisterReceiver(mReceiver02); &&&&&& super.onPause(); &&& } & &&& public class mServiceReceiver extends BroadcastReceiver { &&&&&& @Override &&&&&& public void onReceive(Context context, Intent intent) { &&&&&&&&&& // TODO Auto-generated method stub &&&&&&&&&& if (intent.getAction().equals(SEND_ACTIOIN)) { &&&&&&&&&&&&& try { &&&&&&&&&&&&&&&&& switch (getResultCode()) { &&&&&&&&&&&&&&&&& case Activity.RESULT_OK: &&&&&&&&&&&&&&&&&&&& break; &&&&&&&&&&&&&&&&& case SmsManager.RESULT_ERROR_GENERIC_FAILURE: &&&&&&&&&&&&&&&&&&&& break; &&&&&&&&&&&&&&&&& case SmsManager.RESULT_ERROR_RADIO_OFF: &&&&&&&&&&&&&&&&&&&& break; &&&&&&&&&&&&&&&&& case SmsManager.RESULT_ERROR_NULL_PDU: &&&&&&&&&&&&&&&&&&&& break; &&&&&&&&&&&&&&&&& } &&&&&&&&&&&&& } catch (Exception e) { &&&&&&&&&&&&&&&&& e.getStackTrace(); &&&&&&&&&&&&& } &&&&&&&&&& } else if (intent.getAction().equals(DELIVERED_ACTION)) { &&&&&&&&&&&&& try { &&&&&&&&&&&&&&&&& switch (getResultCode()) { &&&&&&&&&&&&&&&&& case Activity.RESULT_OK: &&&&&&&&&&&&&&&&&&&& break; &&&&&&&&&&&&&&&&& case SmsManager.RESULT_ERROR_GENERIC_FAILURE: &&&&&&&&&&&&&&&&&&&& break; &&&&&&&&&&&&&&&&& case SmsManager.RESULT_ERROR_RADIO_OFF: &&&&&&&&&&&&&&&&&&&& break; &&&&&&&&&&&&&&&&& case SmsManager.RESULT_ERROR_NULL_PDU: &&&&&&&&&&&&&&&&&&&& break; &&&&&&&&&&&&&&&&& } &&&&&&&&&&&&& } catch (Exception e) { &&&&&&&&&&&&&&&&& e.getStackTrace(); &&&&&&&&&&&&& } &&&&&&&&&& } &&&&&& } &&& } } & 界面布局: &?xml version="1.0" encoding="utf-8"?& &LinearLayout xmlns:android="/apk/res/android" &&& android:orientation="vertical" android:layout_width="fill_parent" &&& android:layout_height="fill_parent"& &&& &TextView android:layout_width="fill_parent" &&&&&& android:layout_height="wrap_content" android:text="发送短信" /& &&& &TextView android:text="收信人地址:" android:id="@+id/textView1" &&&&&& android:layout_width="wrap_content" android:layout_height="wrap_content"&&/TextView& &&& &EditText android:text="" android:layout_width="match_parent" &&&&&& android:id="@+id/address" android:layout_height="wrap_content"&&/EditText& &&& &TextView android:text="短信内容:" android:id="@+id/textView2" &&&&&& android:layout_width="wrap_content" android:layout_height="wrap_content"&&/TextView& &&& &EditText android:text="" android:layout_width="match_parent" &&&&&& android:id="@+id/content" android:layout_height="wrap_content"&&/EditText& &&& &Button android:text="发送" android:id="@+id/send" &&&&&& android:layout_width="wrap_content" android:layout_height="wrap_content"&&/Button& &/LinearLayout& &
&activity android:name=".SMSSender" android:label="@string/app_name"& &&&&&&&&&& &intent-filter& &&&&&&&&&&&&& &action android:name="android.intent.action.MAIN" /& &&&&&&&&&&&&& &category android:name="android.intent.category.LAUNCHER" /& &&&&&&&&&& &/intent-filter& &&&&&& &/activity&
import android.content.BroadcastR import android.content.C import android.content.I import android.os.B & public class BroadcastTest2 extends BroadcastReceiver { & &&& @Override &&& public void onReceive(Context arg0, Intent arg1) { &&&&&& System.out.println("运行线程:&&& " + Thread.currentThread().getId() + "&& " &&&&&&&&&&&&& + Thread.currentThread().getName()); &&&&&& System.out.println("广播意图的动作:&" + arg1.getAction()); &&&&&& Bundle bundle = new Bundle(); &&&&&& bundle.putString("test", "zhongnan"); &&&&&& setResultExtras(bundle); &&& } } & 接收器2: import android.content.BroadcastR import android.content.C import android.content.I import android.os.B & public class BroadcastTest1 extends BroadcastReceiver { & &&& @Override &&& public void onReceive(Context arg0, Intent arg1) { &&&&&& System.out.println("运行线程:&&& " + Thread.currentThread().getId() + "&& " &&&&&&&&&&&&& + Thread.currentThread().getName()); &&&&&& System.out.println("广播意图的动作:&" + arg1.getAction()); &&&&&& Bundle bundle = getResultExtras(false); &&&&&&
&&&&&& if (bundle == null) { &&&&&&&&&& System.out.println("没有得到上次传递的数据"); &&&&&& } else { &&&&&&&&&& System.out.println("测试:&" + bundle.getString("test")); &&&&&& } &&& } } &
import android.app.A import android.content.I import android.os.B & public class MainActivity extends Activity { &&& /** Called when the activity is first created. */ &&& @Override &&& public void onCreate(Bundle savedInstanceState) { &&&&&& super.onCreate(savedInstanceState); &&&&&& setContentView(R.layout.main); &&&&&& this.sendOrderedBroadcast(new Intent( &&&&&&&&&&&&& "android.provier.zhongnan.broadcast"), null); &&& } } & AndroidManifest.xml文件: &manifest xmlns:android="/apk/res/android" &&& package="com.zhongnan.bc" android:versionCode="1" android:versionName="1.0"& &&& &uses-sdk android:minSdkVersion="8" /& &&& &application android:icon="@drawable/icon" android:label="@string/app_name"& &&&&&& &activity android:name=".MainActivity" android:label="@string/app_name"& &&&&&&&&&& &intent-filter& &&&&&&&&&&&&& &action android:name="android.intent.action.MAIN" /& &&&&&&&&&&&&& &category android:name="android.intent.category.LAUNCHER" /& &&&&&&&&&& &/intent-filter& &&&&&& &/activity& &&&&&& &receiver android:name=".BroadcastTest1"& &&&&&&&&&& &intent-filter& &&&&&&&&&&&&& &action android:name="android.provier.zhongnan.broadcast" &&&&&&&&&&&&&&&&& android:priority="400" /& &&&&&&&&&& &/intent-filter& &&&&&& &/receiver& &&&&&& &receiver android:name=".BroadcastTest2"& &&&&&&&&&& &intent-filter& &&&&&&&&&&&&& &action android:name="android.provier.zhongnan.broadcast" &&&&&&&&&&&&&&&&& android:priority="500" /& &&&&&&&&&& &/intent-filter& &&&&&& &/receiver& &&& &/application& &/manifest& & BroadcastTest2setResultExtras(Bundle bundle)方法,关于Bundle类,类似于HashMap,不熟悉的朋友可以参考文档,或者查看我的另一篇博客。在后面的接收器中使用getResultExtras(boolean flag)接收前面的接收器存放的数据,其中的boolean参数含义为:true代表如果前面的接收器没有存放数据,则自动创建一个空的Bundle对象,false则表示如果前面的接收器如果没有存放任何数据则返回null。 & 广播接收器中权限的定义: &&& 在发送广播时,无论是无序广播(Normal Broadcast)还是有序广播(Ordered Broadcast)都有类似的方法: (Intent intent, String receiverPermission), sendOrderedBroadcast (Intent intent, String receiverPermission) &
import android.content.BroadcastR import android.content.C import android.content.I import android.os.B & public class BroadcastTest2 extends BroadcastReceiver { & &&& @Override &&& public void onReceive(Context arg0, Intent arg1) { &&&&&& System.out.println("运行线程:&&& " + Thread.currentThread().getId() + "&& " &&&&&&&&&&&&& + Thread.currentThread().getName()); &&&&&& System.out.println("广播意图的动作:&" + arg1.getAction()); &&&&&& Bundle bundle = new Bundle(); &&&&&& bundle.putString("test", "zhongnan"); &&&&&& setResultExtras(bundle); &&& } } & 接收器2: import android.content.BroadcastR import android.content.C import android.content.I import android.os.B & public class BroadcastTest1 extends BroadcastReceiver { & &&& @Override &&& public void onReceive(Context arg0, Intent arg1) { &&&&&& System.out.println("运行线程:&&& " + Thread.currentThread().getId() + "&& " &&&&&&&&&&&&& + Thread.currentThread().getName()); &&&&&& System.out.println("广播意图的动作:&" + arg1.getAction()); &&&&&& Bundle bundle = getResultExtras(false); &&&&&&
&&&&&& if (bundle == null) { &&&&&&&&&& System.out.println("没有得到上次传递的数据"); &&&&&& } else { &&&&&&&&&& System.out.println("测试:&" + bundle.getString("test")); &&&&&& } &&& } } &
import android.app.A import android.content.I import android.os.B & public class MainActivity extends Activity { &&& /** Called when the activity is first created. */ &&& @Override &&& public void onCreate(Bundle savedInstanceState) { &&&&&& super.onCreate(savedInstanceState); &&&&&& setContentView(R.layout.main); &&&&&& this.sendOrderedBroadcast(new Intent( &&&&&&&&&&&&& "android.provier.zhongnan.broadcast"), "xzq.zhongnan.test"); &&& } }
this.sendOrderedBroadcast(new Intent( &&&&&&&&&&&&& "android.provier.zhongnan.broadcast"), "xzq.zhongnan.test")增加了自定义的一个权限。 在AndroidManifest文件中配置自定义的权限: &&& &permission android:protectionLevel="normal" android:name="xzq.zhongnan.test"&&/permission&
&uses-permission android:name="xzq.zhongnan.test"&&/uses-permission&
& & & & 组件。
阅读(1524)}

我要回帖

更多关于 miracastreceiver 的文章

更多推荐

版权声明:文章内容来源于网络,版权归原作者所有,如有侵权请点击这里与我们联系,我们将及时删除。

点击添加站长微信