Search code examples
androidbroadcastreceiver

Starting Service from BroadcastReceiver


I have a Service and BroadcastReceiver in my application, but how do I launch the service directly from the BroadcastReceiver? Using

startService(new Intent(this, MyService.class));

does not work in a BroadcastReceiver, any ideas?

EDIT:

context.startService(..);

works, I forgot the context part


Solution

  • Don't forget

    context.startService(..);