If the GPS is navigating and DisableSensors is run shortly followed by EnableSensors then the application crashes. If however the GPS was only searching then all is well. If the selection of EnableSensors is delayed for a short while then all is well.
The crash occurs as the GPS transitions from search to navigate (pulsing indicator to steady)
Code: Select all
On EnableSensors
try
mobileStartTrackingSensor "location", false --false means use most accurate (GPS)
mobileStartTrackingSensor "heading", false --false means use most accurate
mobileStartTrackingSensor "acceleration", false --false means use most accurate
put "Sensors: location and heading have been enabled at maximum accuracy." into tdebug
printerror tDebug
catch TheError
answer "Enable Sensors reports : " & TheError
end try
end EnableSensors
On DisableSensors
mobileStopTrackingSensor "location"
mobileStopTrackingSensor "heading"
mobileStopTrackingSensor "acceleration"
put "Sensors: location, heading and acceleration have been disabled." into tDebug
printerror tDebug
end DisableSensors