广播是否在广播接收器 (android) 中排队或丢弃?
Are broadcasts queued or dropped in broadcast receivers (android)?
查看文档:
https://developer.android.com/guide/components/broadcasts
不清楚((至少)对我而言)广播是按顺序处理、并行处理还是丢弃(以防广播接收器收到广播但尚未完成前一个广播的处理)。
whether or not broadcasts are processed sequentially, in parallel or dropped
广播基于 publish-subscribe 设计模式。
onReceive
方法在主线程中运行,所以是顺序运行的。
Android 系统会将所有广播排入队列,直到它们被传送到您的接收器,以便丢弃其中 none 个。
此外,onReceive
方法有 10 秒的超时时间,之后 android 认为接收方已被阻止。因此,如果您的 onReceive
方法对于单个广播花费的时间太长,android 将 block/kill 它并且后续广播消息将是 missed/dropped.
查看文档:
https://developer.android.com/guide/components/broadcasts
不清楚((至少)对我而言)广播是按顺序处理、并行处理还是丢弃(以防广播接收器收到广播但尚未完成前一个广播的处理)。
whether or not broadcasts are processed sequentially, in parallel or dropped
广播基于 publish-subscribe 设计模式。
onReceive
方法在主线程中运行,所以是顺序运行的。
Android 系统会将所有广播排入队列,直到它们被传送到您的接收器,以便丢弃其中 none 个。
此外,onReceive
方法有 10 秒的超时时间,之后 android 认为接收方已被阻止。因此,如果您的 onReceive
方法对于单个广播花费的时间太长,android 将 block/kill 它并且后续广播消息将是 missed/dropped.