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();
}
}
i created this project from eclipse->new android project-> and then
wrote this code.
Alarm is set, but never fired. neither in simulator nor in the device.
Whats wrong ? need i do something in manifest file ?
regards
Jagat
--
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