| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 4:04 PM |
Procedure GPS_VerificaStatus()
Retorno is string = ""
GloLatitude , GloLongitude is real = 0
GPSInitParameter(gpsSatellite,gpsPrecisionHigh)
Retorno is geoPosition = GPSGetPosition()
GloLatitude = NumToString(Retorno..Latitude,"+-10.6f") GloLongitude = NumToString(Retorno..Longitude,"+-10.6f")
Retorno = GloLatitude +"; "+ GloLongitude
IF GloLatitude = 0 AND GloLongitude = 0 OR GloLatitude = null AND GloLongitude = null ToastDisplay("GPS Desligado!!!") END
RESULT(Retorno ) |
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 4:06 PM |
import android.app.Activity; import java.lang.*; import android.util.*; import java.lang.Exception; import android.util.Log; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle;
PUBLIC static void GPS_On() { Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE"); intent.putExtra("enabled", True); getActiviteEnCours().sendBroadcast(intent); }
|
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 4:06 PM |
import android.app.Activity; import java.lang.*; import android.util.*; import java.lang.Exception; import android.util.Log; import android.content.BroadcastReceiver; import android.content.Context; import android.content.Intent; import android.os.Bundle;
PUBLIC static void GPS_Off() { Intent intent = new Intent("android.location.GPS_ENABLED_CHANGE"); intent.putExtra("enabled", False); getActiviteEnCours().sendBroadcast(intent); }
|
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 5:00 PM |
OBS.: É necessário ativar essas opções no Android Manifest XML do Windev Mobile:
A) Android.Permission.WRITE_SECURE_SETTINGS
Android.Permission.WRITE_SETTINGS
|
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 5:08 PM |
OBS.: Caso não marque as opções acima ocorrerá um erro como esse abaixo descrito:
|
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 5:30 PM |
Outra maneira de testar se esta desligado o GPS:
//GLOBAL GloGpsAtivado is boolean = False
//Open Window
Procedure GPS_Inicializar()
GPSInitParameter(gpsSatellite,gpsPrecisionHigh +gpsSpeed)
IF GPSStatus() <> gpsEnabled THEN
Popup("Para melhorar a precisão da sua localização, ative o seu GPS","L")
gloStatusGps = False
ELSE ChangeGPSStatus(GPSStatus()) END
GPSStatus(ChangeGPSStatus)
//Procedure Global
Procedure ChangeGPSStatus(nStatus)
IF gnCurrentStatus = nStatus THEN RETURN END gnCurrentStatus = nStatus
IF nStatus = gpsEnabled OR nStatus = gpsAvailable THEN
GPSFollowMovement(GetPosition,300)
END SWITCH nStatus
CASE gpsEnabled GloGpsAtivado = True CASE gpsDisabled GloGpsAtivado = False gloStatusGps = False CASE gpsOffService CASE gpsUnavailable CASE gpsAvailable END
|
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 6:03 PM |
OBS.: Com o código java no projeto Android é possivel desligar e ligar o GPS via codigo ao abrir o aplicativo colocando GPS_ON() e desligar ao sair colocando no embed de codigo close window GPS_OFF() ou em botoes na tela. Lembrando que é necessário atribuir no AndroidManifest.Xml a permissão de escrita nas configurações do sistema. No Wizard na ultima tela antes de concluir mande re-escrever o AndroidManifest.Xml caso tenha dado algum erro.
Sendo assim finalizo esse post, aguardo por sugestões de melhoria e comentarios se conseguiram testar os 3 exemplos acima.
Ótimos estudos da plataforma PcSoft a todos! |
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 6:37 PM |
Conforme me pediram segue a localização da Tela onde fica o AndroidManifest.XML Seria a penúltima tela do Wizard de Compilação do projeto Android
Botão: Avanced Configuration
|
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 6:38 PM |
Botão: Edit Manifest
|
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 6:39 PM |
Botão: Reinicialize
|
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on February, 14 2015 - 6:41 PM |
AndroidManifest.Xml Atualizado, só complilar que a função GPS_On() e GPS_Off() está funcionando!!!!!
|
| |
| |
| | | |
|
| | |
| |
Registered member 3,661 messages Popularité : +175 (223 votes) |
|
Posted on June, 11 2015 - 10:57 PM |
| |
| |
| | | |
|
| | |