androidタスクバー常住アイコンの追加
1825 ワード
private void initNotification()
{
int notificationID = 10;
NotificationManager notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
// Create the notification
Notification notification = new Notification(R.drawable.clock, "TestActivity ",
System.currentTimeMillis());
notification.flags |= Notification.FLAG_ONGOING_EVENT; // "Ongoing" " "
notification.flags |= Notification.FLAG_NO_CLEAR; // " " , , FLAG_ONGOING_EVENT
notification.flags |= Notification.FLAG_SHOW_LIGHTS; // set LED on
// notification.defaults = Notification.DEFAULT_LIGHTS; // Notification lights;
notification.ledARGB = R.color.blue; // LED ;
notification.ledOnMS = 5000; // LED
// Create the notification expanded message
// When the user clicks on it, it opens your activity
Intent intent = new Intent(this, TestActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(this, 0,
intent, 0);
notification
.setLatestEventInfo(this, "TestActivity", "17:50 ", pendingIntent);
// Show notification
notificationManager.notify(notificationID, notification);
}
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
initNotification();
iniTimePick();
}