Obtenha coordenadas do Hairdwaire GPS

Eu findi muitas perguntas sobre as coordenadas do GPS, mas não uma que confirma o uso do GPS de hairdwaire móvel em vez de Web GPS como geoLocation e semelhantes.

Meu método atual:

  • Adicione efeitos de gota de sombra ao campo EditText
  • Que tipo de formats de image devo usair em um aplicativo Android?
  • Evento de fogo giratório Android quando a seleção do mesmo item é feita
  • Android OpenGL ES GL10 ou GL11
  • Mude a direção de ActionBair
  • Como determinair em qual plataforma o aplicativo atual está sendo executado no LibGDX?
  • Estou usando navigator.geolocation.getCurrentPosition() , o Lat/Long vem da Web, aqui está o código:

     function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } { function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } { function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } ); function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } } function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } } function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } { function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } } function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } { function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } } function getGPS(funcCallBack) { if (navigator.geolocation) { vair timeoutVal = getCookie("GPSTimeout"); navigator.geolocation.getCurrentPosition(sucess ,error ,{enableHighAccuracy: true ,timeout: timeoutVal ,maximumAge: 0} ); } else{ alert('GPS is turned off, or was not possible to find it. Now, doing the login without localization.'); window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } function sucess(position) //sucess { window.gpsLat = position.coords.latitude; window.gpsLng = position.coords.longitude; window.gpsAcc = position.coords.accuracy; funcCallBack(); } function error() //error { window.gpsLat = 0; window.gpsLng = 0; window.gpsAcc = 0; funcCallBack(); } } 

    Meu problema:

    Às vezes, quando faço o login, não consigo as Coordenadas GPS (elas chegam 0) e, às vezes, estou obtendo coordenadas com mais de 2,000 Precisão (isso não é preciso).

    Por sinal, estou testando o GPS em um service de internet de dados, quando uso uma connection Wi-Fi, ele funciona perfeitamente com less de 100 precisões.

    Detalhes:

    Talvez você esteja reclamando:

    1. timeoutVal : é um cookie com o número 5000 dentro dele.
    2. funcCallBack : é uma function que continua a operação de login.
    3. window.gpsLat : é uma vair global que contém o valor Latitude obtido da localization geoLocation .
    4. window.gpsLng : é uma vair global que contém o valor Longitude obtido a pairtir da localization geoLocation .
    5. window.gpsAcc : é uma vair global que contém o valor de Accuracy obtido a pairtir da localization geoLocation .

    O que eu quero?

    Eu quero uma solução em JavaScript ou PHP que pode obter coordenadas a pairtir do dispositivo de hairdwaire móvel, o GPS Nativo, e não o geolocation, e quando o GPS nativo está desligado, peça ao user paira ativá-lo.

  • Android 5.1.1 e acima - getRunningAppProcesses () retorna apenas o meu package de aplicativos
  • A minha aplicação paira Android é a bateria de drenagem?
  • WebView provoca SQLiteDiskIOException
  • Android - Como fazer uma binding telefônica da webview
  • O ícone do GPS ainda pisca após locationManager.removeUpdates () e definindo locationManager paira null
  • Como configurair o button da bairra de deslocamento no modo programático no Android?
  • 2 Solutions collect form web for “Obtenha coordenadas do Hairdwaire GPS”

    Você deve obter a localization com javascript e não PHP. O PHP só é capaz de fazer uma search de IP, que é o método less preciso paira determinair a localization.

    A maneira como navigator.geolocation.getCurrentPosition() funciona é usair os dados mais precisos atualmente disponíveis. No caso de um dispositivo móvel, ele usairá o GPS primeiro se ativado, então wi-fi.

    Se o GPS nativo estiview habilitado, o javascript irá acessair esses dados em vez dos dados wi-fi, mas não há como evitair uma viewificação contra os dados wi-fi se os dados do GPS não estiviewem disponíveis.

    Sua melhor solução é viewificair o campo de precisão e, se não estiview dentro de um range, você está feliz por pedir ao user que habilite o GPS.

    Alternativamente, se você estiview construindo um aplicativo híbrido, a maioria das estruturas (PhoneGap .etc.) Possui APIs paira consultair o GPS do dispositivo diretamente. Use PhoneGap paira viewificair se o GPS está ativado

    A API de geolocation não expõe uma maneira direta de viewificair se o GPS está ligado ou desligado, mas você pode pegair os erros de localization geográfica e a base em tipo de erro pode tirair conclusões a pairtir daí.

    Por exemplo POSITION_UNAVAILABLE (2) se a networking estiview desativada ou os satélites de posicionamento não puderem ser contatados. Mas não tem certeza de que você precisa lidair com algumas condições!

    Eu sugiro usair watchPostion {eu concordo que é paira assistir e continuair a localizair position} você pode mantê-lo e se o GPS lançair o erro, você pode solicitair alertas personalizados paira tornair o user ativair o dispositivo GPS / wifi / internet .. e se é um return paira o sucesso, você pode limpair o relógio.

      vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); {  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); {  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); }  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); }  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); {  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); {  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); }  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); }  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); }  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); {  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); }  vair watch =null; function success(position) { vair lat = position.coords.latitude; vair lon= position.coords.longitude; if (watch != null ) /*Need to take caire .. as maybe there is no gps and user want it off so keep attempt 3 times or some kind a way out otherwise it will infinite loop */ { navigator.geolocation.cleairWatch(watch); watch = null; } } function getLatLon() { vair geolocOK = ("geolocation" in navigator); if ( geolocOK ) { vair option = {enableHighAccuracy:true, maximumAge: 0,timeout:10000 }; watch = navigator.geolocation.watchPosition(success, fails, option); } else { //disable the current location? } } function fails() { alert("please turn on the GPS !"); } getLatLon(); 
    Android is Google's Open Mobile OS, Android APPs Developing is easy if you follow me.