> I was doing alarm manager and stuff. > > i did like below > > public class AlarmExample extends Activity { > private Button setAlarmButton = null; > > /** Called when the activity is first created. */ > @Override > public void onCreate(Bundle savedInstanceState) { > super.onCreate(savedInstanceState); > setContentView(R.layout.main); > > setAlarmButton = (Button) findViewById(R.id.Button01); > setAlarmButton.setOnClickListener(new OnClickListener() { > public void onClick(View v) { > > Intent intent = new Intent(AlarmExample.this, > OnetimeAlarmReceiver.class); > PendingIntent pendingIntent = > PendingIntent.getBroadcast > (AlarmExample.this, 1, intent, 0); > > AlarmManager alarmManager = (AlarmManager) > getSystemService > (ALARM_SERVICE); > alarmManager.set(AlarmManager.RTC_WAKEUP, > System.currentTimeMillis > () + (10 * 1000), pendingIntent); > > Toast.makeText(AlarmExample.this, "Alarm set", > Toast.LENGTH_LONG).show(); > } > > }); > } > } > > > > public class OnetimeAlarmReceiver extends BroadcastReceiver { > > @Override > public void onReceive(Context context, Intent intent) { > Toast.makeText(context, "Alarm worked.", > Toast.LENGTH_LONG).show(); > } > }
Don't use a Toast from a BroadcastReceiver. Use Log to write to LogCat, or write a line to a text file on the SD card, or something. > Alarm is set, but never fired. neither in simulator nor in the device. > Whats wrong ? need i do something in manifest file ? LogCat (from adb logcat, DDMS, or the DDMS perspective in Eclipse) might have some hints. For example, is your BroadcastReceiver declared in the manifest? -- Mark Murphy (a Commons Guy) http://commonsware.com Android App Developer Books: http://commonsware.com/books.html -- 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