J'ai une liste de coordonnées (plus de 30 paires de longitudes latitudes) et ma tâche est la suivante:envoyer une notification GPS de partout
je devrais créer une application Android qui envoie une notification (sur la barre d'état) à l'utilisateur s'il/elle est sur l'un des 30 emplacements que contient ma liste. La partie de notification est prête, je peux le faire dans une activité (itérer dans la liste, si les coordonnées sont égales, puis envoyer la notification, mais comment faire pour toutes les activités, et pour les moments où l'application est en cache, mais pas ouvrir? Merci
Intent intent = new Intent(AGPS.this, SecondClass.class);
TaskStackBuilder stackBuilder = TaskStackBuilder.create(AnotherGPS.this);
stackBuilder.addParentStack(SecondClass.class);
stackBuilder.addNextIntent(intent);
PendingIntent pendingIntent = stackBuilder.getPendingIntent(0, PendingIntent
.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder mBuilder =
(NotificationCompat.Builder) new NotificationCompat.Builder(AnotherGPS.this)
.setSmallIcon(R.drawable.cam_icon)
.setContentTitle("My notification")
.setContentText("content of notification")
.setContentIntent(pendingIntent);
NotificationManager NM = (NotificationManager) getSystemService(Context
.NOTIFICATION_SERVICE);
NM.notify(0, mBuilder.build());
Merci pour la réponse rapide. Je vérifierai! –