Hi,
I am beginner to android development. I want to make an application
for an alarm clock. I want alarm with some predefined ring tones. But
I don't know how to use the existing alarm service. I have written
below code, but it is not running. So can you please suggest me.
Thanks in advance.
My code is like this :
public class AlarmClock extends Activity {
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
AlarmManager alarmManager = (AlarmManager)
getSystemService(ALARM_SERVICE);
Intent intent = new Intent(getApplicationContext(),
OnetimeAlarmReceiver.class);
PendingIntent pendingIntent =
PendingIntent.getBroadcast(getApplicationContext(), 0, intent,
0x08000000);
alarmManager.setRepeating(AlarmManager.RTC_WAKEUP,
System.currentTimeMillis(), (5 * 1000), pendingIntent);
Toast.makeText(getApplicationContext(), "Alarm set",
Toast.LENGTH_LONG).show();
}
}
--
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