I have an app with :
- an activity class that allows the user to set multiple alarms.
- a service class to manage those alarms in the background.
- a receiver class to do certain work when the alarm is called.
Everything works fine.
Now I want to automatically start the service when the phone boots up. The onBootReceiver is received but the app crashes (NPE) when this line is reached in my service class:
Intent intent = new Intent (MainActivity.getContext(),AReceiver.class);
I can't use this instead of MainActivity.getContext() either.
Any ideas of what may be causing this?
Thanks :)