it should be the same as a dismissable message except you change the Flag.
Notification.FLAG_ONGOING_EVENT
instead of
Notification.FLAG_AUTO_CANCEL
When a notification is clicked the intent you send is run, so you make sure that Activity does whatever task you want.
private void showRecordingNotification(){
Notification not = new Notification(R.drawable.icon, "Application started", System.currentTimeMillis());
PendingIntent contentIntent = PendingIntent.getActivity(this, 0, new Intent(this, main.class), Notification.FLAG_ONGOING_EVENT);
not.flags = Notification.FLAG_ONGOING_EVENT;
not.setLatestEventInfo(this, "Application Name", "Application Description", contentIntent);
mNotificationManager.notify(1, not);
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…