Saturday, January 31, 2009

Android notifications

This is a work in progress. I don't think the light notification is working yet.


if (notifyVibrate){
Notification notification = new Notification();
notification.vibrate = new long[] { 100, 250, 100, 500};
nm.notify(NOTIFY_ID, notification);
}
if (notifyLight) {
Notification notification = new Notification();
notification.ledARGB = 0xFFFF5171;
notification.ledOnMS = 100;
notification.ledOffMS = 100;
notification.flags = Notification.FLAG_SHOW_LIGHTS;
nm.notify(NOTIFY_ID, notification);
}
if (notifyToast) {
Toast toast = Toast.makeText(timer.this , R.string.notification_text, Toast.LENGTH_SHORT);
toast.setGravity(Gravity.CENTER, 0, 0);
toast.show();
}
if (notifySound) {
mp.play(timer.this, Settings.System.DEFAULT_NOTIFICATION_URI, false, AudioManager.STREAM_ALARM);
}

No comments:

Post a Comment