Thanx Chen I dont understand completely your solution.
My app as a routenavigstion app does four things 1 gets the location 2 display the data 3 move the marker on the map 4 reads out loud the navigation data I like to keep the app running for hours . I have enough battery power through connecting the phone to a powerbank. So i have two issues 1 how to keep the proces of fetching the location alive 2 how do i keep the app alive to display the data and reads out loud the data. The first issue could be solved with the backgroundlistner. But can i update my datafield on screen from the backgroundlistner. In vb net , the background process are on a different thread. I have to send the data to the other thread. I sthat the same in android. The second issue i can solve with keeping the screen on. Or starting the app again when the app is killed. The problem with that solution is that i need a workarround, because the first screen is a splash screen. So, how does a route navigation app keeps the app and the locationmanager awake? Op donderdag 3 oktober 2019 05:01:24 UTC+2 schreef Shai Almog: > > Background execution is hard core for mobile. Native platforms make it > hard on purpose because you're essentially running all the time and > "wasting battery" so they don't really want you to do that. > > When the app is in the foreground you can get location constantly using > the LocationManager (that's the point you display it on the screen). But > when the app is minimized the system will kill your app if you keep doing > that (as that's taking a lot of battery). So when stop() is invoked in your > main class you need to stop polling location. You can then switch to using > background location updates using > https://www.codenameone.com/javadoc/com/codename1/location/LocationManager.html#setBackgroundLocationListener-java.lang.Class- > > notice that it works very differently to the regular location listener. > -- You received this message because you are subscribed to the Google Groups "CodenameOne Discussions" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/codenameone-discussions/57dd95e8-8b75-430b-9b4b-32d2696b11c2%40googlegroups.com.
