Background Tasks Location Sensor

Hi All , I read this thread related to Background Tasks Credited to : @Kumaraswamy , and i'm wondering if someone guide me to right block should use to make app works fine in the background or just a test aia and i wilk implment it
here's my blocks

Hi, from android 9 - 10+, it isn't directly possible to access the location. Special permission needs to be granted and an extra line should be added to the android manifest.

1 Like

Maybe you could use Location Service Extension

1 Like

But location service extension is paid

2 Likes

Doesn't matter, as long as it completes what the OP wants, it's a solution.

2 Likes

The Location Service Extension unfortunately may not work as you intend. Read HOW TO: use LocationService extension with a GoogleSpreadsheet to record real time locations while the app is in the background . It collects data in real time; however it will not report it to your device until the device later awakes when it will provide the data collected while the device is asleep.

Taifun does provide a free example showing how the LSExtension works; however, yes as mentioned, it is a paid extension. You could try it to see if it meets your requirements.

As an alternative to working in the Background, use the LocationSensor in conjunction with a StayAwake routine. How to do that is discussed briefly at the conclusion of the above tutorial. The alternative solution provides constant location information using StayAwake and it does allow constant use of the gps receiver to report data. Until someone provides a way to use the Background extension, you might try that.

1 Like

Thanks for your reply ,you mean it will not be effective to use this approach in my app

Hi Steve , ther's another 2 ways i think you are expert enough to give your feedback in them
First One : I will use Google maps Location Sharing and append it in my app with web viwer and lextract the result from this
Second one : using IFTT applets create applet and append it to my app but i searched alot nothing founded on internet for something like this

Note : Paid extention Location using that tecnique IFTTT To send Email Automatically in his extention

are this approaches will help to keep tracking location in background

Ther's somthing i attend to do , but idon't khnow if it's correct or not
what about manual working :smiley:
first one : using another componnent in my app allow to let app works in backgrounds fine , For Example if SMS or Phone Call or navigation or other commponnent if added will this works fine ? in simply way , if ther's another componnent here works in background in MIT Ap inventor
Second one : if ther's manula setting after install apk to add the apk to to System root so it can works in background i think it will meet my requirment

What you do depends on how you intend the app to work. I guess, but do not know, that you might want to provide notifications when certain coordinate conditions exist or to provide coordinates a certain intervals. That cannot be done with the LocationService Extension in real time.

Never experimented with Location Sharing feature of Google Maps. You could try. This is your app and only you know how it is supposed to work (you haven't actually described how the app is intended to provide coordinate information in the background).

Perhaps iftt applet - Google Search is a dump search using Google.

You might wish to consider using your app with the Google Maps app or Navigate using an ActivityStarter. Is that possible. Certainly but I don't know whether you would get the information you want/need.

A problem I see with all three of these possibilities is your app reporting (providing a Notification of the location in the background) . I suspect the location coordinates Notification will probably fail when your App Inventor app goes to sleep.

Experiment and let us know what you discover Tommy. Google Map Navigate seems to be able provide notifications; so something written in Java might be able to too. So far none of the extension wizards have come up with code capable of doing so.

1 Like

Really , i appreciate your detailed reply here , and thanks for this
First : all i want to accomplish i that :
-simply return cordination for device every 3 Minutes .
Second : Location sharing from google Maps Looks like this


in this white area current location appeared and changed on the map every time location changes
so i'm seeking if here in MIT App inventor workround solution To listen and extract this piece of information , i thinks it will works well

If you use a StayAwake routine, this is very easy to do using a Label, the LocationSensor and setting the Location.TimeInterval to 3 minutes ( 180000 ms). A little bit fancier way to build an app is
How to broadcast a GPS location and share the information on a map with others in real time..CloudDB. When your app goes to sleep, the sharing stops. :cry:

OK. You probably need to use Google Map's api location sharing and it might work OK (as long as your App Inventor app is in the foreground). When your app goes into the background, I expect it would no longer work. Do I know that for a fact. No, so experiment. :slight_smile:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.