关于安卓广播无法启动接收器的问题
16lz
2021-01-26
Unable to start receiver activitytest.example.com.receive.MyBroadcastReceiver: java.lang.UnsupportedOperationException: 接收不到
public class MyBroadcastReceiver extends BroadcastReceiver { public MyBroadcastReceiver() { } @Override public void onReceive(Context context, Intent intent) { // TODO: This method is called when the BroadcastReceiver is receiving // an Intent broadcast. Toast.makeText(context, "received in MyBroadcastReceiver", Toast.LENGTH_SHORT).show();// throw new UnsupportedOperationException("接收不到"); }}
要去掉throw new UnsupportedOperationException 才不会报错
更多相关文章
- Android模拟强制下线通知功能实例代码
- 动态注册广播接收器
- Android(安卓)汉字转拼音
- Android利用BroadcastReceiver实现短信监听
- Android(安卓)adb.exe找不到的解决方法
- Android在Service服务中调用Activity活动的方法,实现UI界面更新操
- Android使用Socket(Tcp/Udp)协议进行数据传输(传输大文件)
- Android小玩意儿-- 从头开发一个正经的MusicPlayer(二)
- Android面试系列之一