iOS troubles, way to get background location data?

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
Scoperzor
Posts: 78
Joined: Tue Jan 27, 2015 1:10 pm

iOS troubles, way to get background location data?

Post by Scoperzor » Tue Apr 28, 2015 8:45 am

Posted here because I don't get replies in the iOS deployment board and this seems like a basic understanding of Livecode that I'm missing.

My app requires background updates from location services, but I cannot figure out how to do that. The app is suspended and killed after a few minutes if the standard info.plist is used, however I notice that within the info file you can add "Required background modes - App registers for location updates" and "Application does not run in the background". If I adjust either of these and resign by using codesign, the signature is not a problem but Xcode returns the error "App installation failed - The application could not be verified."

I've tried all the suggestions on stackoverflow without success, and I would like to ask here if anyone knows a way around this, or even a better way of going about getting background location data without running into these verification issues. It is really stumping me after days of searching around.

Sean

Kevvy
Posts: 20
Joined: Fri Jan 10, 2014 7:06 am

Re: iOS troubles, way to get background location data?

Post by Kevvy » Tue May 05, 2015 10:10 am

I would also like to know of this functionality. Have you had any responses regarding this ?
Could anyone here please assist in a way to keep receiving the gps co-ords whilst the iPad is in standby or the app is minimised ?

Thanks

Cheers
Kevvy

SparkOut
Posts: 2943
Joined: Sun Sep 23, 2007 4:58 pm

Re: iOS troubles, way to get background location data?

Post by SparkOut » Tue May 05, 2015 8:23 pm

On Android too would be great, if anyone knows how

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: iOS troubles, way to get background location data?

Post by LCNeil » Wed May 06, 2015 11:02 am

Hi All,

Currently we do not support the backgrounding of application on any of our mobile platforms and unfortunately cannot support any workarounds that are suggested. There are a few underlying technicalities holding back backgrounding support but we are aware that the backgrounding of applications is a huge want for our users so it is something we are actively looking into.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
-

Scoperzor
Posts: 78
Joined: Tue Jan 27, 2015 1:10 pm

Re: iOS troubles, way to get background location data?

Post by Scoperzor » Thu May 07, 2015 9:13 am

Neil, thanks for the reply.

If that is not possible, can you or someone else let me know if co-ordinate tracking is possible when a data connection is not present?

i.e. on iPad I'm using mobileStartTrackingSensor and mobileCurrentLocation, and location services will not be initiated until I activate wifi (and thus establish a data connection). As far as I understood these could still work without a data connection, but I don't see any reference to this in the documentation here: http://lessons.runrev.com/m/4069/l/3037 ... al-compass

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: iOS troubles, way to get background location data?

Post by LCNeil » Thu May 07, 2015 10:10 am

Hi Scoperzor,

As far as I'm aware, Wifi only iPads do not have a GPS chip present and rely on Wifi connectivity for approximate location tracking. This could be why location services require a wifi connection on your iPad.

iPads with Cellular capabilities do have a GPS chip so this will be used for location tracking on these models.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
-

Scoperzor
Posts: 78
Joined: Tue Jan 27, 2015 1:10 pm

Re: iOS troubles, way to get background location data?

Post by Scoperzor » Fri May 08, 2015 9:05 am

The iPad I'm testing on is a Wifi + 3G model, it just doesn't have a sim in it. It seems the problem does not occur every time - when I open the app and run the location tracking commands, about 10% of the time it will activate the location tracking (location icon appears at the top of the iPad). However most of the time it does not work. It is strange to me that it is temperamental.

Here is the initial code (part of it) to check the sensors etc:

Code: Select all

 if the environment is "mobile" then
      mobileStartTrackingSensor "location",false
      if mobileCanTrackLocation() is "false" then
         put mobileCurrentLocation() into theiPadLocation
         if theiPadLocation is empty then
I checked mobileCanTrackLocation, and it always returns true.

And here is the code getting the co-ordinates:

Code: Select all

   if the environment is "mobile" then
      mobileStartTrackingSensor "location",false
      put mobileCurrentLocation() into theiPadLocation
      put theiPadLocation["latitude"] into iPadLat
      put theiPadLocation["longitude"] into iPadLon

Scoperzor
Posts: 78
Joined: Tue Jan 27, 2015 1:10 pm

Re: iOS troubles, way to get background location data?

Post by Scoperzor » Fri May 08, 2015 12:36 pm

Update: I included the trackingError message and it has returned:

trackingError "location","The operation couldn't be completed. (kCLErrorDomain error 0.)"

Any help on this?

Update 2: The location tracking works when Wifi (and with no connection to any network with internet) is enabled, but not when Wifi disabled. There is no sim card in the device, could that have any effect on things?

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: iOS troubles, way to get background location data?

Post by LCNeil » Fri May 08, 2015 2:12 pm

Hi Scoperzor,

This could be a bug as I don't believe this has been reported before-

Could you give the following lesson a go to see how you get on and see if location services is a bit more reliable for you-

http://lessons.runrev.com/m/4069/l/3037 ... al-compass

Another suggestion, from a quick internet search is to try the following-

1) go to settings and reset your location services
2) reset your network settings

Keep us posted on how you get on.

Kind Regards,

Neil Roger
--
LiveCode Support Team ~ http://www.livecode.com
-

jacque
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7389
Joined: Sat Apr 08, 2006 8:31 pm
Contact:

Re: iOS troubles, way to get background location data?

Post by jacque » Fri May 08, 2015 4:42 pm

Just guessing, but devices without GPS have to use network connections to get approximate locations. Without wifi they can't do that. So the behavior seems consist to me.
Jacqueline Landman Gay | jacque at hyperactivesw dot com
HyperActive Software | http://www.hyperactivesw.com

Scoperzor
Posts: 78
Joined: Tue Jan 27, 2015 1:10 pm

Re: iOS troubles, way to get background location data?

Post by Scoperzor » Mon May 11, 2015 6:26 am

I found some information which, if correct, will have helped me answer my questions:
The GPS does work without a SIM card installed. GPS apps from the app store that display location as latitude/longitude/altitude will work without the SIM (although it will take longer to do the localization, and it will only work out in the open, since without the SIm the GPS must function without the assistance of the cell towers.
... from https://discussions.apple.com/thread/1726921

I have been testing indoors, without a sim, when in fact I need to be outdoors if I don't have a sim or wifi enabled. That explains why it was only recording location data when I switched the wifi back on.

Post Reply