GPS - Feature, Application Crash

The place to discuss anything and everything about running your LiveCode on Android

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

GPS - Feature, Application Crash

Post by Simon Knight » Fri Jul 27, 2012 9:04 am

I am developing an application that reads data from the sensors available on a Galaxy S2 handset. The routine EnableSensors is called when the application starts reading data and the DisableSensors when no more data is required.

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
best wishes
Skids

sturgis
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 1685
Joined: Sat Feb 28, 2009 11:49 pm

Re: GPS - Feature, Application Crash

Post by sturgis » Fri Jul 27, 2012 2:54 pm

Your code works perfectly for me on an htc evo, android 4.03. Only changed the logging to use my stuff.

Have you tried starting the sensors singly? At least that way you can determine if there is a specific sensor that causes the trouble.

Simon Knight
Posts: 919
Joined: Wed Nov 04, 2009 11:41 am

Re: GPS - Feature, Application Crash

Post by Simon Knight » Sat Jul 28, 2012 9:51 am

Good idea, I'll have a look when I get a moment. Good to know that it works on Android 4.03 and a different handset.

best wishes

Simon
best wishes
Skids

Post Reply