Jump to content

[Debutant] notification dans x jours


perrysoft

Recommended Posts

Bonjour

Je début en développement androïde et je butte sur un problème avec les notifications.

Je m’explique je suis en train de réaliser un programme de gestion de lentilles de contact et j’aimerai prévenir l’utilisateur qu’il doit changer ses lentilles de contact pour cela j’aimerai programmer une notification dans x jours même si le programme est fermé.

Dans tous les exemples que j’ai vus il y a une variable When dans la déclaration de la notification. Et ca n’as pas l’aire de fonctionné. Je n’ai peut être pas compris le rôle de cette variable.

Connaissez vous une moyen de réalisé ceci ?

Voici ma fonction :


public void notifyme () {
   	NotificationManager notificationManager;	
   	notificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
               notificationManager.cancel(2009);
   	long durée1minute = 1000*60;
	long temp =System.currentTimeMillis() + (120 * durée1minute);
	Notification notification = new Notification(R.drawable.icon,"Gestion de vos lentilles de contact",temp);
	notification.vibrate = new long[] {0,100,25,100};
	PendingIntent pendingIntent = PendingIntent.getActivity(this, 0, new Intent(this,Main.class ), 0);
	String titreNotification ="Gestion de vos lentilles de contact";
	String textNotification = "Vous devez bientôt changer vos lentilles de contact";
	notification.setLatestEventInfo(this, titreNotification, textNotification, pendingIntent);
	int idRefNotification = 2009;
	notificationManager.notify(idRefNotification,notification);	

   }

Cordialement

Sébastien

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...