Binding service by BroadcastReceiver

后端 未结 8 1043
春和景丽
春和景丽 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 15:59

    Just simple. Opt 1: I created an empty Activity (non UI, just onCreate() for Bind service) and finish(). In Broadcast > Start Activity with Bundle (if needed). Problem's resolved.

    Opt 2: The same way above options but using an Service instead of Activity. Get event Broadcast > Start a new Service > Bind to existing Service you want to bind.

提交回复
热议问题