Android Question Share GPS status between Activity

Paolo Pini

Member
Licensed User
Longtime User
Hi,
I have a main activity reading GPS coordinates and status showing the actual position on map.
I would like to call another page to show coordinates and GPS status (satellites, speed, etc).
I create another page in designer to show this data but obviously calling it with StartActivity the main GPS activity go to pause and GPS stop to update.
What's the best manner to do this behaviour, is possible do not pause the main activity?

Many thanks in advance.

Paolo
 

toby

Well-Known Member
Licensed User
Longtime User
Store the data in starter service's process global variables, for example, starter.lat=lat

then read starter.lat in another activity
 
Upvote 0

Paolo Pini

Member
Licensed User
Longtime User
Store the data in starter service's process global variables, for example, starter.lat=lat

then read starter.lat in another activity

Hi thanks, but the when I call the other activity GPS pause anyway isn't?, I would like to have real time
 
Upvote 0

toby

Well-Known Member
Licensed User
Longtime User
Use Fused location provider in starter service to get realtime gps data.
 
Upvote 0

Paolo Pini

Member
Licensed User
Longtime User
I apologize for my English... :)

I have already the GPS coordinates (pic 1).

When press the info button on bottom right I open a details activity with html page where I would like to continue to show the actual speed and satellites number. (pic 2).

The problem is that the Main activity in Pic 1 go to Pause and I'm unable to continue to read actual GPS info.

Probably my error was to manage the GPS in main?

Thanks
 

Attachments

  • Screenshot_20180625-131036.png
    Screenshot_20180625-131036.png
    188.9 KB · Views: 249
  • Screenshot_20180625-131052.png
    Screenshot_20180625-131052.png
    129 KB · Views: 226
Upvote 0

Paolo Pini

Member
Licensed User
Longtime User
I found the problem!

I leave the 'Stop GPS' outside the UserClosed condition in the Main.

B4X:
Sub Activity_Pause (UserClosed As Boolean)
CallSub(Starter, "StopGPS") 
If UserClosed Then
    KeepScreenOn(False)
End If
End Sub

I'm sorry my bad!

Thanks for your time.
 
Upvote 0
Top