Hello,

I am having the following problem and was wondering whether
anyone here could be so kind so as to help me. I am having a
broadcast receiver in my code that opens a database and sets
an alarm. However the code that sets the alarm is never called
as shown in the adb logcat output. What is interesting is that the
application does not crash but the intent that is called after the
alarm setter was supposed to be called is run. So the intent
that is launched after the alarm was supposed to be set is
called even though I see no debug output telling me that
the alarm setter function is called.

Any ideas as to what is going on?

(please see code below)

Thanks,

John Goche

public class AlarmReceiver extends BroadcastReceiver {

  @Override
  public void onReceive(Context context, Intent intent) {

    Log.d("AlarmReceiver", "received");

    // retrieve database handle

    DB db = DB.db(context);

    // retrieve data from database

    Globals.data = db.getData();

    // reset alarms (seems like this does not get called)

    Log.d("AlarmReceiver", "Calling alarm setter...");
    AlarmSetter.doSetupAlarm(context);
    Log.d("AlarmReceiver", "Done.");

    // start new intent (this actually starts up for real)

    Intent i = new Intent(context, AlarmExpiredActivity.class);
    i.putExtra("alarmMessages", intent.getBundleExtra("alarmMessages"));
    i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
    context.startActivity(i);

  }

}

class AlarmSetter {

  public static void doSetupAlarm(Context ctx) {

    Log.d("AlarmSetter", "doSetupAlarm called.");

   // ...

}

D/AlarmReceiver( 3805): received
I/ActivityManager(   61): Starting: Intent { flg=0x10000000
cmp=com.bar.foo/.AlarmExpiredActivity (has extras) } from pid 3805

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

Reply via email to