IOSLocation in the background not working

Hi all,

I’m pretty new to Xojo, as we recently started development op IOS devices. (I come from a microsoft-based environment, but after more then 20 years (I’m 43 now), I wanted some changes in my life …)
I started with swift, but recently made the switch to Xojo, as it looks easier :slight_smile:

Currently preparing and doing some tests, I came across a rather strange issue.
While using the IOSLocation, It doesn’t seem to run in the background, while running on a real iPhone 6S with iOS 10.3
(everything works in the simulator however)

  • I already added the necessary stuff to my info.plist:

    NSLocationAlwaysUsageDescription
    DigiHome Tracker needs access to your location.


    UIBackgroundModes

    location
    fetch
    audio


    It does work in fullscreen mode, but not in background mode :frowning:

I use EasyTCPSocketIOS to transfer the location-data to a server, and I even see it getting disconnected when the iPhone automatically turns off.
Is this due to the fact that I’m using thi TCPSocket from within the LocationChanged Event ?
(But UDP is currently not yet implemented in IOS Xojo ?)

Any help or advice is appreciated :slight_smile:

Best regards from Belgium,
Kris

I think there are only certain classes of applications that are allowed to operate in the background indefinitely. I think fitness apps are one of them. I had a running app that use to work fine in the background, but my latest compile with the new version is not working properly in the front or back, so I’m not sure what is wrong with it. Haven’t had time to delve into it yet.

In my app, I have pretty much the same thing you do, minus fetch for background modes. I also initialize CoreLocationManager with activity type fitness, and I have an AVSession that is setup as well. Other than that I don’t think I am doing anything else that affects background operation, so I’m not sure what else might be missing.

I think there is a possibility with sockets that no matter how you set it up it could still be kicked out in the background. I think I recall something along the lines of 10 seconds and after that all bets are off. This is all from memory, so I could be completely wrong. I think I read it on a mailing list or stack overflow or some such site.

Hi All,

Is there any known ways to get this working, as I can’t seem to find anywhere that outlines a working solution to this ??