Estou com problema para pegar a latitude e longitude no Android. Usando esta função, sempre o "location" retorna "null".
public void onCreate() { LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); Criteria criteria = new Criteria(); criteria.setAccuracy(Criteria.ACCURACY_FINE); String provider = locationManager.getBestProvider(criteria, false); Location location = locationManager.getLastKnownLocation(provider); if (location != null) { la = location.getLatitude(); lo = location.getLongitude(); Log.d("create", "la = " + la + " e lo = " + lo); new Thread(localizacao.this).start(); } else { Log.d("update", "location null"); } } <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>Podem me ajudar?
You received this message because you are subscribed to the Google Groups "Android Brasil - Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to androidbrasil-dev+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.






0 comentários:
Postar um comentário