Foreground execution

Just starting out? Need help? Post your questions and find answers here.
BarJo
Posts: 5
Joined: Mon Dec 18, 2023 9:55 am

Foreground execution

Post by BarJo »

Hello everyone,

I just tested SpiderBasic (currently in the free version). I find it really good for developing mobile apps. However, during my tests, I encountered a problem for which I couldn't find a solution.

In my test, I created an app that retrieves GPS coordinates and transmits them to a website. To achieve this, I set up a timer to have a recurrence of GPS data.

My problem lies in the fact that the timer does not work when the app is not in the foreground.

My question is, is it possible to make a timer work in the background? Is there a workaround solution?

Thank you for your help.

Here is a shortened but functional example of my program:

Code: Select all

Procedure Events()
  Debug "GeolocationLatitude  : " + GeolocationLatitude()
  Debug "GeolocationLongitude : " + GeolocationLongitude()
EndProcedure

StartGeolocation(200,#False)

If OpenWindow(0, 0, 0, 300, 200, "Timer", #PB_Window_SystemMenu | #PB_Window_SizeGadget | #PB_Window_ScreenCentered)
  AddWindowTimer(0, 0, 1000)
  BindEvent(#PB_Event_Timer, @Events())
EndIf
Thank You.