views:

467

answers:

1

Is there any problem with launching a service via an Alarm's BroadcastReceiver's onReceive? My service never has it's onCreate or onStart method called.

My Alarm's receiver gets a wakelock, calls context.startService(new Intent(context, FmiDaemon.class)); (context given via onRecieve parameter), waits 3 seconds, then releases the lock.

My service has 2 methods, onCreate and onStart. onCreate gets another wakelock, the end of onStart releases the wakelock, and calls "stopSelf". Both methods are supposed to send data to a log, but never do since they're never called.

Where is the problem? Is that a bad "context" to use? Is onCreate and onStart the wrong methods to implement?

A: 

Try adding this within the application tag of your AndroidManifest.xml file.

<service android:name="com.yourpackagetoyourserviceclass.FmiDaemon"/>
Chiwai Chan
I already did, still not working