Skip to content Skip to sidebar Skip to footer

Calling Alarmmanager In Service

Context: I am attempting to implement one service call a second service (a subclass of the first) via an AlarmManager. To do this, I needed to create a Broadcast Receiver as an inn

Solution 1:

Am I failing to implement a method?

Well, LocalWordSubClass seems to be devoid of methods, other than inherited ones.

Also, you are attempting to send a broadcast Intent to a Service (via your PendingIntent), which is not going to work.

And, the BroadcastReceiver you have defined in LocalWordSubClass is unused.

Next, from your related comment:

I have the initial service call a new subclass (which has access to the LocationClient) after a two minute period

Your "new subclass" will have its own mLocationClient, unrelated to any mLocationClient from any other Service in your process.

You appear to be attempting to implement something I wrote about in the preceding comment:

@jsc123: "How would you recommend I give my LocationClient a two minute window to connect before polling the location?" -- you could just use AlarmManager, calling set() to get control in two minutes.

What I meant by that was that you would use set() on AlarmManager with a getService()PendingIntent to deliver control back to your already-running Service with its already-acquired WakeLock, so that it can obtain the location, release the WakeLock, and stopSelf().

Post a Comment for "Calling Alarmmanager In Service"