Infatti non è vero che non si possono avere notifiche schedulate.
O meglio quello che si può fare e aggiungere un notifica futura:
Ovviamente a questa parte di codice va aggiunto un receiver che si occuperà di ricevere la notifica ed eventualmente di schedularne un'altracodice:Intent notificationIntent = new Intent(this, NotificationPublisher.class); notificationIntent.putExtra(NotificationPublisher.NOTIFICATION_ID, 1); notificationIntent.putExtra(NotificationPublisher.NOTIFICATION, notification); PendingIntent pendingIntent = PendingIntent.getBroadcast(this, 0, notificationIntent, PendingIntent.FLAG_UPDATE_CURRENT); long futureInMillis = SystemClock.elapsedRealtime() + delay; AlarmManager alarmManager = (AlarmManager)getSystemService(Context.ALARM_SERVICE); alarmManager.set(AlarmManager.ELAPSED_REALTIME_WAKEUP, futureInMillis, pendingIntent);
codice:NotificationManager notificationManager = (NotificationManager)context.getSystemService(Context.NOTIFICATION_SERVICE); Notification notification = intent.getParcelableExtra(NOTIFICATION); int id = intent.getIntExtra(NOTIFICATION_ID, 0); notificationManager.notify(id, notification);

Rispondi quotando