Binding service by BroadcastReceiver

后端 未结 8 1040
春和景丽
春和景丽 2021-02-12 15:32

My Application uses a service that is started by a BOOT_COMPLETE BroadcastReceiver, in run i\'m getting an error

my code:

public class projet extends Br         


        
8条回答
  •  长情又很酷
    2021-02-12 16:02

    If you know that the Service is running you can aquire its Binder with BroadcastReceiver.peekService(Context, Intent) method (See peekService docs).

    But, as it is already said in the other answers, it is not allowed to bind a Service from within a BroadcastReceiver.

提交回复
热议问题