我在不同的时间设置了三个闹钟,现在我想设置三个不同的通知,在闹钟触发时显示。
这是我的<?php
if (!isset($_GET['page'])) {
displayForm();
return;
}
// Now you could switch over your _GET['page']
switch($_GET['page']) {
case "update":
break;
case "new":
default:
displayForm();
break;
}
:
BroadcastReceiver
这是我的闹钟设置代码:
@Override
public void onReceive(Context context, Intent intent)
{
Intent notificationIntent = new Intent(context, MainActivity.class);
notificationIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
PendingIntent contentIntent = PendingIntent.getActivity(context,
0, notificationIntent,
PendingIntent.FLAG_CANCEL_CURRENT);
Uri alarmSound = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
NotificationCompat.Builder mBuilder =
new NotificationCompat.Builder(context);
mBuilder.setContentIntent(contentIntent)
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("E' ora di colazione!")
.setContentText("Cosa c'è per colazione?")
.setSound(alarmSound)
.setLights(Color.BLUE, 1000, 500)
.setVibrate(new long[] { 1000, 1000})
.setAutoCancel(true);
NotificationManager mNotificationManager = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
mNotificationManager.notify(1, mBuilder.build());
}