Tecnologia do Blogger.
RSS

Re: [androidbrasil-dev] Pegar latitude longitude Android - Location == null

Provavelmente vc nao tem o last know location. Seta o listener que existe nessa API e espera receber a LA/LO.


2014-01-30 Matheus Piscioneri <mxczpiscioneri@gmail.com>:
Poderia dar um exemplo prático? Li esse artigo do Google e fiquei meio perdido.

Obrigado!

Em quinta-feira, 30 de janeiro de 2014 16h36min22s UTC-2, daniel.capelassi escreveu:
Olá. Tente seguir esta forma de pegar a localização que usa o google
play services. Implementei ele aqui, é rápido e sempre encontra a
localização.

http://developer.android.com/training/location/receive-location-updates.html
-----------------------------------
Att. Daniel N. Capelassi


On Thu, Jan 30, 2014 at 4:16 PM, Matheus Piscioneri
<mxczpis...@gmail.com> wrote:
> Não, estou usando meu celular (I8262)...
>
>
> Em quinta-feira, 30 de janeiro de 2014 16h13min50s UTC-2, Douglas Bezerra
> Possas escreveu:
>>
>> Você esta usando o emulador?
>>
>> Se sim, enviou uma posição válida para ele?
>>
>>
>> 2014-01-30 Matheus Piscioneri <mxczpis...@gmail.com>
>>>
>>> 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-...@googlegroups.com.
>>>
>>> For more options, visit https://groups.google.com/groups/opt_out.
>>
>>
>>
>>
>> --
>> Douglas Bezerra Possas
>> Programador PHP
>> Campo Grande  - MS - Brasil
>> Cel.: 67 9280 5866
>
> --
> 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-...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.

--
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.



--
Marcelo Alves

Software Engineer

malves.info(Skype) 

--
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.

  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • RSS

0 comentários:

Postar um comentário