为什么 AlarmManager 的接收器没有 Intent Filter?

Why does receiver for AlarmManager has no Intent Filter?

我在我的项目中使用 Alarm Manger,我的清单中有此声明。一切正常,一切正常,但我心中有一个疑问,为什么会出现以下情况

 <receiver android:name="wokerClasses.alarmReceiver"></receiver>

在其 onReceive() 中处理接收器的 class 声明没有 intent-Filter?我想了解系统如何调用和识别这个特定的接收者以及为什么没有其他 sendBroadcast() 调用这个接收者。

how does the system invoke and recognize that this specific receiver

您正在使用 getBroadcast() 创建一个 PendingIntent,包装一个 Intent 来标识此 BroadcastReceiverIntent 是显式 Intent,它标识组件的特定 Java class。 PendingIntent 允许您有选择地授予其他进程(例如管理警报事件的 Android 核心进程)能够向该接收器发送广播,即使该接收器未导出也是如此。

Why no other sendBroadcast() invoke this receiver.

该接收器未导出;系统上没有其他东西可以向它发送广播,除了:

  • 你自己的代码
  • 任何持有 PendingIntent 你给他们的人