Search code examples
androidbroadcastreceiverbindservice

Can we bind binder service through broadcast receiver?


I want to start binder service once application receive broadcast, So can i bind service from receiver like startService or do i need to send callback to activity to bind service? As per my knowledge broadcast receiver has time limit of 10 sec, so does that time limit would affect if i bind service from receiver?


Solution

  • BroadcastReceiver cannot bind to a service. More specifically, the context provided in onReceive() cannot be used to bind to a service or to register dynamic BroadcastReceivers. You will need to start an Activity or Service of your own.