How do I run this app in background?


my app stops to work after I lost focus on it.
I found this extension but not it can help me. Plz I need your help.

Can you tell me what exactly you want to run in the background?

1 Like

i wanna to send text via bluetooth to my arduino. That text consist of NMEA sentences which I get them through gps module . just need to receive data from gps via bluetooth

Hi, I'm not sure what you are refering to, in this sentence:

Do you receive the gps data from arduino? Or is it regarding device's location?

1 Like


i want to send data from text box (tbNmea.text) to arduino.

1 Like

and is the "AdvancedLocationSensor" an extension you are using?

1 Like

yes, I need to have full NMEA sentences

1 Like

my advanced location sensor works perfectly on my android. I have an old android version.
I just have a problem with background . when i close screen or lost focus mith app inventor app it stops sending data from text box (tbNmea.text)

Yes, that is how AI apps work without an extension. You might be able to use Open Source • Background Tasks: Itoo to get ALS to work in the background. Sorry, no tutorial. Alternatively, force your app to stay awake.

Great ASL is working on your device.

2 Likes

Ways to force the screen from sleeping

Here is how you might code a Stay Awake block routine using a Notifier

or you could use Taifun’s Tools Extension: https://puravidaapps.com/tools.php

Using either an extension or a block routine drains your device battery rapidly . These work around methods are not running the app in the Background, they force the app screen to stay open .

1 Like

thanks a lot.
Could you help me to make it work?
Here is my project: :pleading_face:
advLoc3.aia (44.3 KB)

unfortunately . don't work

I do not think that is true Eugene. On my Android 4.2 the aia loads and the app provides lat/long etc. however it does NOT provide the NMEA sentences. This is the same response you get.

Parts of ALS work on low number Androids but the extension does not extract the NMEA sentence, possibly because the extension GpsStatus API does not work

alsError

This means you cannot obtain NMEA using ALS :cry:

On my Android 13, the extension does not even provide the basic data (I see a screen with the Labels but no data) On Android 4.2 I see all the extracted data EXCEPT the NMEA sentences.

Why do you need the actual NEMA sentences? What does the Arduino do with these strings? What data are you trying to capture?

i am trying to make sport watch )
i get NMEA sentences on my phone. even arduino get them correct ly.
i cant connect [Background Tasks: Itoo]

Discovered that the aia does not produce a NMEA on my 4.2 but it does indeed provide the NMEA time on my Android 8.1 tablet but doesn't work at all on my Android 13.

Sorry, don't know either. I know you cannot use a Label, because it is a visible component with Itoo .
You probably can define the timestamp as a global variable. You might ask the question in the Itoo thread.

1 Like

Your procedure with the not so great name procedure needs the same input parameter as the AdvancedLocationSensor.NmeaReceived event
There might be further errors...

It would help to start with same basic examples found in the itoo thread before trying something more complex...

See especially the 2 examples in the first post here Open Source • Background Tasks: Itoo

Taifun

2 Likes