Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
一旦应用程序接收到广播,我想启动绑定服务,那么我可以从像 startService 这样的接收器绑定服务还是需要向活动发送回调以绑定服务?据我所知,广播接收器的时间限制为 10 秒,那么如果我从接收器绑定服务,该时间限制会影响吗?
BroadcastReceiver无法绑定到服务。更具体地说,context提供的 inonReceive()不能用于绑定到服务或注册动态BroadcastReceivers。您将需要启动一个Activity或Service您自己的。
BroadcastReceiver
context
onReceive()
Activity
Service