Salut à tous, dans mon app j'aimerais pouvoir localiser l'utilisateur de manière précise, j'ai suivi pas mal de tuto mais je n arrive pas à obtenir un résultat assez précis (en général on me localise comme chez mes voisins ou un peu plus loin, un bon 30-40 mètres). Et j'ai remarqué que lorsque je désactive la localisation par satellite GPS la localisation ne marche pas, si j ai bien compris elle marche par triangulation l'option du smartphone "utiliser réseaux sans fil" et donc le réseau mobile. Mais cette technique n'a pas l'air d'etre très précise. 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
 
				locationListener = new MyLocationListener();
				lm = (LocationManager) getSystemService(Context.LOCATION_SERVICE);	//control location updates
				//lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 35000, 2, locationListener);
 
				lm.requestLocationUpdates(LocationManager.GPS_PROVIDER, 35000, 2, locationListener);
				/* On va choper le best providers */
				//Criteria crit = new Criteria();
				//towers = lm.getBestProvider(crit, false);	
				//Location location = lm.getLastKnownLocation(towers);
 
 
				Criteria crit = new Criteria();
				crit.setAccuracy(Criteria.ACCURACY_FINE); //Or whatever criteria you want
				towers = lm.getBestProvider(crit, true);
 
				Location location = lm.getLastKnownLocation(towers);
 
 
	        	if (location != null) {
 
	        		lat = location.getLatitude();
	        		longi = location.getLongitude();
 
	        		String latit =   String.valueOf(lat);
	        		String longit = String.valueOf(longi);
 
	        		tvLat = (TextView) view.findViewById(R.id.tvLatitude);
	        		tvLongi = (TextView) view.findViewById(R.id.tvLongitude);
	        		tvAdr = (TextView) view.findViewById(R.id.tvAdresse);
 
 
	    			tvLat.setText(latit);
	    			tvLongi.setText(longit);
 
	    			//Le geocoder permet de récupérer ou chercher des adresses
	    			//gràce à un mot clé ou une position
 
					// to access the adress
					Geocoder geocoder = new Geocoder(NoteReminder.this, Locale.getDefault());
 
					try{
						//max result = 1 because we only want one result
						List<Address> address = geocoder.getFromLocation(location.getLatitude(), location.getLongitude(), 1);
 
						if (address.size() > 0){
							String display ="";
							for(int i = 0; i<address.get(0).getMaxAddressLineIndex(); i++){
 
								display += address.get(0).getAddressLine(i) + "\n";
							}
	    					tvAdr.setText(display);
						}
						else{
	    					tvAdr.setText("L'adresse n'a pu être déterminée");
						}
					} catch (IOException e) {
						// TODO Auto-generated catch block
						e.printStackTrace();
 
						String error = e.toString();
 
 
	  					tvAdr.setText(error);
					}
	        	}	
	        	else{
	        		Toast.makeText(getBaseContext(),
 
	        		"Localisation actuelle FOIRE ",
 
	        		Toast.LENGTH_SHORT).show();
 
	        	}
Voila et je comprend pas pq mon prog foire quand j active "utilisez satellite GPS" sur mon android :s

Est ce que quelqu'un aurait une idée ?