0
我有一个活动,启动一个IntentService来完成一些工作。工作完成后,IntentService广播会宣告成功。BroadcastReceiver的部分锁定?
广播接收器在启动IntentService的同一活动中。
这种情况
Activity A
{
private BroadcastReceiver receiver = new BroadcastReceiver()
{
@override
public void onReceive(Context context, Intent intent)
{
//handle
}
}
protected void onCreate(Bundle savedInstanceState)
{
//initiate IntentService
}
}
IntentService
{
//Launch spaceshuttle . and broadcast success
}
的伪现在发生的事情是,有时在启动航天飞机需要一些时间,而手机进入睡眠状态。因此,据我所知,我认为广播接收机需要获得部分锁定。
但确切的技术这样做一直在逃避我。
请帮忙。
感谢您的建议。然而,在审查了WakefulBroadcastReceiver后,我发现它不适合我的情况。因为WakefulBroadcastReceiver只有在我使用startWakefulService从其中启动一个IntentService时才起作用。就我而言,我的活动激发了IntentService。至于WakeFulIntentService,我现在会研究它 –