I trying to use Notification on API 15 with NotificationCompat.Builder, but if I pass 10 seconds( 100000 in milliseconds) as when parameters the notification starts immediately. Where is the problem? I want to start the notification after 10 seconds, how can I do it?
this is the code of my method
private void createNotification(long when,String data){
String notificationContent ="Notification Content Click Here to go more details";
String notificationTitle ="This is Notification";
Bitmap largeIcon = BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher);
int smalIcon =R.drawable.ic_launcher;
String notificationData="This is data : "+data;
Intent intent =new Intent(getApplicationContext(), NotificationDetailsActivity.class);
intent.putExtra("textkey", notificationData);
intent.setData(Uri.parse("content://" + when));
PendingIntent pendingIntent = PendingIntent.getActivity(getApplicationContext(), 0, intent, PendingIntent.FLAG_NO_CREATE);
NotificationManager notificationManager =(NotificationManager) getApplicationContext().getSystemService(Context.NOTIFICATION_SERVICE);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(
getApplicationContext())
.setWhen(when)
.setContentText(notificationContent)
.setContentTitle(notificationTitle)
.setSmallIcon(smalIcon)
.setAutoCancel(true)
.setTicker(notificationTitle)
.setLargeIcon(largeIcon)
.setDefaults(Notification.DEFAULT_LIGHTS| Notification.DEFAULT_VIBRATE| Notification.DEFAULT_SOUND)
.setContentIntent(pendingIntent);
Notification notification=notificationBuilder.build();
notificationManager.notify((int) when, notification);
}