Jump to content
Sign in to follow this  
Vanar

Service: Restore native activity from background programmatically

Recommended Posts

Hello!

I am developing an Android application using the mechanism from the demo project ForegroundLocationDemo (Delphi 12)

 

ForegroundLocationDemo works fine,
but I can't programmatically restore native activity from the background after reaching the target.

 

Please tell me how to do it so that under a certain condition (say, when a certain location is reached)
programmatically bring native activity out of the background in the procedure:

 

procedure TLocationTrackingModule.LocationSensorLocationChanged(Sender: TObject; const OldLocation, NewLocation: TLocationCoord2D);
begin
   FLocation := NewLocation;
   if FIsRunningInForeground then
   Begin
      FNotificationManager.notify(NotificationId, GetNotification);

   {$REGION 'My code'}
      If NewDistance <= Distance Then
      Begin
         StopLocationTracking; // Stopping this service turns it into only a bound service
         ??? // Restore native activity from background
      End
   {$ENDREGION 'My code'}

   End
   else
   begin
      if Assigned(FLocationUpdated) then
      FLocationUpdated(NewLocation);
   end;
end;
 

Edited by Vanar

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×