X
xdroid-man
Neues Mitglied
- 0
Hallo,
ich habe folgendes Problem.
Ich erzeuge eine Notification, und möchte sie anzeigen aber das gelingt erst beim 2. Mal, wenn der entsprechende Code durchlaufen wird.
Wenn die Notification erst einmal angezeigt wurde, klappt alles wunderbar. Soll heißen das dann alles gleich beim ersten mal angezeigt wird.
Ich hoffe ihr könnt wir helfen.
Danke & Gruß
ich habe folgendes Problem.
Ich erzeuge eine Notification, und möchte sie anzeigen aber das gelingt erst beim 2. Mal, wenn der entsprechende Code durchlaufen wird.
Code:
@SuppressLint("NewApi")
private void setNotification(String weckpunktBezeichnung)
{
Intent intent = new Intent(getActivity().getApplicationContext(), DisableNotification.class);
PendingIntent pendingIntent =
PendingIntent.getActivity(getActivity().getApplicationContext(), 0, intent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationManager notificationManager = (NotificationManager) getActivity()
.getSystemService(Context.NOTIFICATION_SERVICE);
Notification.Builder notificationB = new Notification.Builder(getActivity().getApplicationContext())
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Weckpunkt aktiviert")
.setContentText(weckpunktBezeichnung)
.setAutoCancel(true)
.setDeleteIntent(pendingIntent);
notificationManager.notify(DisableNotification.NOTIFICATION_ID, notificationB.build());
}
Wenn die Notification erst einmal angezeigt wurde, klappt alles wunderbar. Soll heißen das dann alles gleich beim ersten mal angezeigt wird.
Ich hoffe ihr könnt wir helfen.
Danke & Gruß