Skip to content

Issues with the Android Foreground Location Tracking #6

@AdriaanBoshoff

Description

@AdriaanBoshoff

Demo Location: https://github.com/Embarcadero/RADStudio13Demos/tree/main/Object%20Pascal/Multi-Device%20Samples/Device%20Sensors%20and%20Services/ForegroundLocationDemo

Android 16

Delphi 13 Enterprise

Hi,

I've been trying to learn how to do location tracking with android foreground services and I can't seem to get this demo working. I'm having the following issues. Please advise what I'm doing wrong.

  1. When compiling both the App and Service for 64bit android it says that it cant find the following jar file: RADStudio13Demos-main\RADStudio13Demos-main\Object Pascal\Multi-Device Samples\Device Sensors and Services\ForegroundLocationDemo\Service\Android\Debug\ForegroundLocationService.jar'.. (This is fixed by reloading the LSP server. Seems like I need to do this every time I try to compile / build... Really annoying.)
  2. When compiling both for 32 or 64 bits it refuses to deploy stating duplicate entries in the AndroidManifest.xml file. This is easy to fix since I just need to comment out the duplicated service entry that was added by Delphi. (I left the service entry thats added in the template file since this contains the service properties.)
  3. Now after fixing the manifest the app compiles and installs. (Permissions set to always allow)
    3.1 When clicking start I can see the location is being used. There is no service notification being displayed.
    3.2 When closing the app there is still no foreground service notifcation begin displayed. I can also see the location is no longer in use.

Please see attached AndroidManifest and video showing whats going on. Notice the location icon at the top right.

AndroidManifest.xml

https://youtube.com/shorts/ptC5tX0mJuM?feature=share

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions