Вот код, который я хочу создать для уведомления с даты предупреждения до даты вакцинации. В этом уведомлении будут созданы все даты от предупреждения до вакцины. Как это можно сделать?
SimpleDateFormat da = new SimpleDateFormat("d MMM,yyyy");
try {
Date al = da.parse(alert);
Date out = da.parse(output);
Date vac=da.parse(date);
.................................................................................................
if (out.before(al)&& Status.equals("Pending")&& vac.after(out)) {
Cursor ca= db.child_show_data(idofchild);
if(ca.moveToFirst())
{
do
{
nameofchild= ca.getString(ca.getColumnIndex("name"));
}while(ca.moveToNext());
}
Intent notificationintent=new Intent(MybackgroundService.this,done_Activity_of_status.class);
notificationintent.putExtra("id",id);
notificationintent.putExtra("name",name);
notificationintent.putExtra("status",Status);
notificationintent.putExtra("date",date);
notificationintent.putExtra("idofchild",idofchild);
notificationintent.putExtra("id_vacinedetail",id_detail);
notificationintent.putExtra("numdays",numdays);
notificationintent.setAction("Actionstring"+System.currentTimeMillis());
''''''''''''''''''' PendingIntent pendingIntent=PendingIntent.getActivities(MybackgroundService.this,
0,
new Intent[]{notificationintent},
0);
Intent snooze=new Intent(MybackgroundService.this,Timer_Tosnooze.class);
snooze.putExtra("id",id);
snooze.putExtra("name",name);
snooze.putExtra("status",Status);
snooze.putExtra("date",date);
snooze.putExtra("idofchild",idofchild);
snooze.putExtra("alert",alert);
snooze.putExtra("id_vacinedetail",id_detail);
snooze.putExtra("numdays",numdays);
snooze.setAction("Actionstring"+System.currentTimeMillis());
PendingIntent pendingIntent1=PendingIntent.getActivities(MybackgroundService.this,0, new Intent[]{snooze},0);
NotificationCompat.Builder notification=new NotificationCompat.Builder(this)
.setContentText(nameofchild+" "+name+" "+date+" "+Status)
.setContentTitle("Vacination")
.setSmallIcon(R.drawable.ic_sys)
.setContentIntent(pendingIntent)
.setPriority(NotificationCompat.PRIORITY_HIGH)
.addAction(R.drawable.ic_noti,"Done",pendingIntent)
.addAction(R.drawable.ic_noti,"remind me",pendingIntent1)
.setAutoCancel(true)
.setDefaults(Notification.DEFAULT_LIGHTS | Notification.DEFAULT_SOUND);
notification.setAutoCancel(true);
' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '' '*
NotificationManager manager=(NotificationManager) this.getSystemService(this.NOTIFICATION_SERVICE);
manager.notify(Unique_Integer_Number,notification.build());
Unique_Integer_Number++;
}
} catch (ParseException e) {
e.printStackTrace();
}
}
} while (c.moveToNext());
...... .................................................. ...................................