Noticias

¡RECUERDA QUE SI ERES UN NUEVO USUARIO, DEBES PRESENTARTE PARA PODER PUBLICAR MENSAJES! | TENEMOS CANAL OFICIAL DE TELEGRAM: t.me/unity3dspain

Coordenadas GPS

Iniciado por cricore, Agosto 03, 2017, 11:20:36 AM

Tema anterior - Siguiente tema
Agosto 03, 2017, 11:20:36 AM Ultima modificación: Agosto 06, 2017, 10:32:42 PM por pioj
Hola, estoy realizando una app y necesito obtener las coordenadas gps del teléfono, he visto varios tutoriales y lo que hacen es lo siguiente:    
 

Input.location.Start ();//inicializa el input de localización
        //        Input.location.Start() method has a default distance value to be updated. by default it has 10m, thus you need to walk 10m to see the changes. Change those values at the moment of initialitation.
        //        Input.location.Start(10,0.1f); // accuracy, every 0.1m
 
        latitud = Input.location.lastData.latitude;//latitud del dispositivo
        //float latitud = 39.366922f;
        yield return latitud;
         longitud = Input.location.lastData.longitude;//longitud del disp.
        //float longitud = -0.462656f;
        yield return longitud;
 
        //Parámetros: https://developers.google.com/maps/documentation/static-maps/intro?hl=es-419#Paths
        urlMap= "https://maps.google.com/maps/api/staticmap?center="+latitud+","+longitud+"&markers=color:red%7Clabel:S%"+latitud+","+longitud+"&zoom="+zoom+"&size=512x512"+"&maptype=roadmap&markers=color:red%|label:|"+latitud+","+longitud+"&type=road&sensor=true?a.jpg";
        WWW www = new WWW(urlMap);//Request a la www
        yield return www;
        imageMap.texture = www.texture;//textura de la imagen del mapa
        latitudText.text = ""+ latitud;
        longitudText.text = "" + longitud;

 
 
 
 
 
Pero a mi no me lee las coordenadas del teléfono, siempre salen a 0. ¿Alguien me puede ayudar?.
 
 
 
Muchas gracias.
 
 
 
Un saludo.
 
 

tienes q activar la localización por gps, otra es que tu cel o tableta no tenga

al momento de abrir la aplicacion , te pide permiso de gps? o prendes de antemano la opcion en el device ?

Activo el gps antes de iniciar la app y los permisos de gps me los pide y los acepto.. pero sigue sin leer las coordenadas..

Agosto 04, 2017, 02:49:56 PM #4 Ultima modificación: Agosto 04, 2017, 02:50:46 PM por Braltor
prueba si lee las coordenadas con otra app
 
talvez Unity no detecta el GPS de tu dispositivo, entonces tendrias que usar la API de Java desde Unity, o hacer un plugin
 
 
 
tambien mira esto: https://northrush.wordpress.com/2014/01/13/access-gps-data-on-unity-3d/

He probado con otros dispositivos y tampoco los lee.. he estado investigando y se ve que es la versión de Unity3d que no se porque no detecta las coordenadas, he instalado una versión anterior  y si que las lee..


Etiquetas: