On Sat, May 19, 2012 at 10:14 AM, Bill Michaelson
<[email protected]> wrote:
> In the startup logic of my service is the code which instantiates an
> inner class (Alarm) which serves as the BroadcastReceiver and also
> provides the utility function to set the alarm...
>
>      if (!pulse.isAlive()) {
>         pulse.start();
>         alarm = new Alarm();
>         String acs = Alarm.class.toString();
>         IntentFilter ifilt = new IntentFilter(acs);
>         registerReceiver(alarm,ifilt);
>         alarm.setAlarm((Coordinator)this,15000); // in 15 secs
>         Log.d(TAG,"ALARM SH BE SET -----------------*_*_*_*_* -
> "+acs);
>      }

The primary point behind AlarmManager is to run code when nothing else
of your code is running. Why are you using both AlarmManager *and*
what appears to be a long-running service?

Note that your BroadcastReceiver is being registered with an
IntentFilter that uses an action string.

> But I don't see expected trace meesage from the BroadcastReceiver...

Because you are not broadcasting an Intent that will be picked up by
that IntentFilter.

>         Intent i = new Intent(context,Alarm.class);

This broadcast does not use an action string. It uses a component.
This would be a fine choice if your BroadcastReceiver were registered
in the manifest, but yours is not.

If you want to send a broadcast to an IntentFilter that uses an action
string, your Intent that you are broadcasting must use the same action
string (e.g., new Intent("this.is.my.action.string")), not a
component.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to *Advanced* Android Development_ Version 2.6
Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to