Set, Locationsensor.active: = True.
When you press the home key or the black screen, the program hangs immediately. The Locationsensorlocationchanged event also does not respond.
Some people say it takes two or three seconds to hang up, to me this is immediately, I do not know why.
solutions that you know on the Internet: http://www.fmxexpress.com/ learn-to-use-the-location-sensor-in-the-background-with-firemonkey-in-delphi-10-berlin-on-ios/
After testing, it is found that it does not fully operate in the background. The general operation was stopped 10 minutes.
Specific solutions: On the above web site basis (flocater. Setallowsbackgroundlocationupdates(True); ), you also need to add
Flocater.setpauseslocationupdatesautomatically (False);
That is
If tosversion. Check(9) and (flocater <> nil) Then
begin {$ if defined (backgroundupdates) and< Span class= "crayon-h" > defined (CPUARM64< Span class= "Crayon-sy" >) } //for some reason, This function crashes in 32-bit flocater.requestalwaysauthorization; flocater. Setallowsbackgroundlocationupdates(True); flocater.setpauseslocationupdatesautomatically (False); {$ENDIF} end;
iOS locationsensor background run