Re: [问题] 接收广播问题

楼主: lightchengtw (阿光)   2021-08-03 11:43:04
"接收到广播"会触发myBroadcastReceiver.OnReceive, 在OnReceive()中"执行动作"即可.
版主有什么原因一定要用if 判断式吗?
※ 引述《lihohsin (新)》之铭言:
: 使用广播接收
: IntentFilter filter = new IntentFilter("com.xxxx");
: MyBroadcastReceiver myBroadcastReceiver = new MyBroadcastReceiver();
: registerReceiver(myBroadcastReceiver,filter);
: 想使广播接收变成触发条件
: if(接收到广播){
: //执行动作
: }
: 这个if() 条件判断该怎么写呢?
作者: aiweisen (艾维森)   2021-08-05 06:50:00
因为他注册完广播后 intent 没有加入filter(addAction)所以全部的广播都会收到

Links booklink

Contact Us: admin [ a t ] ucptt.com