val intent = Intent() intent.action = "com.example.firstapp.TEST_BROADCAST_RECEIVER" // intent.component = ComponentName( // packageName, // "com.example.firstapp.components.TestBroadcastReceiverActivity" // ) intent.setPackage(packageName) sendBroadcast(intent)
这样修改就可以收到了。