Notificationproblem

R

r4in

Ambitioniertes Mitglied
3
Hi Leute,

wenn ich folgenden Code benutze dann werden mir die "Action Buttons" nicht angezeigt.
Code:
NotificationManager mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE); 
                
                NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(getApplicationContext()).setSmallIcon(R.drawable.ic_launcher)
                            .addAction(android.R.drawable.ic_dialog_alert, "updaten", pi)
                            .addAction(android.R.drawable.ic_input_delete,"löschen",ei) 
                            .setContentTitle("Update")
                            .setContentText("Ein neues Programmupdate ist verfügbar.");
                 
                 mNotificationManager.notify(100, mBuilder.build());
benutze ich diesen:

Code:
 Notification notification = new NotificationCompat.Builder(getApplicationContext()) //using the Notification.Builder class
                     .setContentTitle("Update")
                     .setTicker("Ein neues Update ist verfügbar.")
                     .setContentText("Ein neues Programmupdate ist verfügbar.")
                     .setSmallIcon(R.drawable.icon)
                     .setPriority(Notification.PRIORITY_HIGH)
                     .addAction(android.R.drawable.ic_dialog_alert, "updaten", pi)
                     .addAction(android.R.drawable.ic_input_delete,"löschen",ei ).build();
                 notificationManager.notify(1000, notification);
werden sie mir angezeigt, aber kann die Notification nicht aus einem Service starten.

Mein Problem ist also, ich muss aus einem Service eine Noftification starten können die "Actions" kann. Hat der vielleicht jemanden ne Idee?

Danke
 
Zurück
Oben Unten