Bonjour à tous

J'ai un problème assez bizarre avec la geolocalisation dans une de mes applications :
- je veux récupérer la position du device (LocationManager)

- cela marche sur mon galaxy S3 (Android v4.1.2)
- mais pas sur mon galaxy S4 (Android v4.2.2) !!!

voici mon code:

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
 
protected void getPosition() { 
        LocationManager objgps =                (LocationManager)getSystemService(Context.LOCATION_SERVICE);
        MyGPSListener gpsListener = new MyGPSListener(objgps);
        objgps.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0,         gpsListener);
}
 
private class MyGPSListener implements LocationListener{
    private LocationManager LM;
    boolean isGPSEnabled = false;
    boolean isNetworkEnabled = false;
    boolean canGetLocation = false;
 
    public MyGPSListener(LocationManager LM) {
            this.LM = LM;
            isGPSEnabled = LM.isProviderEnabled(LocationManager.GPS_PROVIDER);
            Log.i("GPSenabled", "> "+isGPSEnabled);
 
            isNetworkEnabled=LM.isProviderEnabled(LocationManager.NETWORK_PROVIDER);
            Log.i("NETWORKenabled", "> "+isNetworkEnabled);
 
    }
    @Override
    public void onLocationChanged(Location location) {
            MainActivity.currenGeoLocation = location;
            Toast.makeText(getApplicationContext(), "Votre position : "+location.getLatitude()+" --             "+location.getLongitude(), Toast.LENGTH_LONG).show();
            LM.removeUpdates(this);
}
pour info, les 2 booléens isGPSEnabled & isNetworkEnabled sont tous les 2 à true sur le galaxy S4 comme sur le S3.
Simplement, le onLocationChanged() n'est jamais appelé sur le S4 (4.2.2) et le loader tourne indéfiniment.

J'ai parcouru pas mal de posts notemment sur SOF mais même si beaucoup de gens eprouvent les mêmes difficultés que moi, je n'ai encore trouvé aucune solution!

Je post donc ici au cas où quelqu'un connaitrait la solution??
D'avance merci,