Notification wird nicht angezeigt

  • 1 Antworten
  • Letztes Antwortdatum
A

Androokie

Neues Mitglied
0
Hallo Entwickler,
ich habe das Problem, dass bei dem folgendem Code:

Code:
	        final Button button_NOTIFICATION = (Button)findViewById(R.id.button_Notification);
	        button_NOTIFICATION.setOnClickListener(new View.OnClickListener() {
	            public void onClick(View v) {
	            	int icon = R.drawable.notification;        // icon from resources
	            	CharSequence tickerText = "Hello";              // ticker-text
	            	long when = System.currentTimeMillis();         // notification time
	            	Context context = getApplicationContext();      // application Context
	            	CharSequence contentTitle = "Alarm";  // expanded message title
	            	CharSequence contentText = "That is the alarm!";      // expanded message text

	            	Intent notificationIntent = new Intent(AlarmMainAct.this, AlarmEdit.class);
	            	PendingIntent contentIntent = PendingIntent.getActivity(AlarmMainAct.this, 0, notificationIntent, 0);

	            	// the next two lines initialize the Notification, using the configurations above
	            	Notification notification = new Notification(icon, tickerText, when);
	            	// notification.flags |= Notification.FLAG_AUTO_CANCEL;
	            	notification.setLatestEventInfo(context, contentTitle, contentText, contentIntent);	
	
	            }
	        });

nach Betätigen des Buttons die Notification nicht angezeigt wird. Beim Debuggen sehe ich aber, dass dieser ausgeführt wird.
Was kann das Problem sein?

Vielen Dank im Voraus!
 
fehlt da nicht ein

notificationManager.notify(id, notification);
 

Ähnliche Themen

AnnaBauer21
Antworten
0
Aufrufe
604
AnnaBauer21
AnnaBauer21
Zurück
Oben Unten