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 才不会报错