Sending queries several times , HttpPost

52 views Asked by At

I make my application for sending a POST request that sends GPS coordinates, but unfortunately it is realized that sometimes he sent 3 and 5 or even 1 .

So I do not understand why the same coordinates are sent multiple times.

//Méthode appelée au démarrage du Service
@Override
public int onStartCommand(Intent intent, int flags, int startId)
{
    showNotification();//Appel de la méthode qui créé la barre de Notification

    if (monLocationManager != null && monLocationProvider != null) {

        //Vérification toutes les 30 secondes (40000 millisecondes ) si la position change
        //d'au moins 20 métres. Si c'est le cas, l'écouteur (instance de MajListener)
        //va etre averti
        monLocationManager.requestLocationUpdates(monLocationProvider, 30000, 20, new MajListener(this));
    }

    // Si le service est tué il ne redémarrera pas
    return Service.START_NOT_STICKY;
}

Furthermore , I believe with the emulator we not have this problem

Thank you

0

There are 0 answers