How to Track Your Users Location in the Background in Android - Android Studio Tutorial

How to Track Your Users Location in the Background in Android - Android Studio Tutorial

Philipp Lackner

1 год назад

73,666 Просмотров

Ссылки и html тэги не поддерживаются


Комментарии:

@jopadjr
@jopadjr - 26.11.2023 02:28

1.3K+...Thanks Philipp. Great tutorial !! Would you mind adding Google Map series in your premium course?

Ответить
@amit140891
@amit140891 - 22.11.2023 06:21

Watched 3times, and don't understand... It went over my head...

Ответить
@avinashgupta4038
@avinashgupta4038 - 16.11.2023 07:09

the code not working, can you please make another video on this topic

Ответить
@dididragon
@dididragon - 04.11.2023 11:45

This is not a background location, it is a messaging foreground app explanaition. By the way, it does not work continuesly!

Ответить
@abdullahtutun
@abdullahtutun - 16.10.2023 22:17

You haven't used the ACCESS_BACKGROUND_LOCATION permission in the project. Would this cause any issues when uploading the app to Google Play?

Ответить
@jansk598
@jansk598 - 08.10.2023 19:50

Hi,does the foreground service run also when device is locked and in sleep mode?

Ответить
@retechitsolution2564
@retechitsolution2564 - 19.09.2023 02:01

Thank its good prectice for me.
But one my question How to send location on pho server

Ответить
@AnkitKumar-dd8fo
@AnkitKumar-dd8fo - 15.09.2023 15:10

Adding foregroundServiceType="location" in Manifest file is very crucial for foreground service to run even if app is closed in higher android version.

Ответить
@panagiotisangelosisiris6315
@panagiotisangelosisiris6315 - 11.09.2023 12:58

Hi Phillip! Can I take the coordinates from this foreground service and print them also on screen, somehow?

Ответить
@JonuGurjar
@JonuGurjar - 08.09.2023 09:28

Hi Phillip, I was seeking the same solution but it's not working when app gets killed, can you please add something

Ответить
@kiruthigat0152
@kiruthigat0152 - 06.09.2023 11:10

Hi philipp,Could you please upload a video on monitor geofence

Ответить
@marvelrivera1194
@marvelrivera1194 - 02.09.2023 02:45

Phillip my location isn't changing.. just the same location on every update

Ответить
@marvelrivera1194
@marvelrivera1194 - 01.09.2023 14:40

Nice one

Ответить
@additionalaccount4974
@additionalaccount4974 - 14.08.2023 13:06

everything is fine but the location is hella inaccurate.
i need very precise location
please help

Ответить
@alexsaputik7016
@alexsaputik7016 - 26.07.2023 09:34

WARNING!!! Virus in a library you used!!!

I have just tried to run your example code from GitHub on a Windows machine and got this Virus Warning from my Antivirus (Dr.Web):

Android.BankBot.348.origin
C:\Users\youruser\.gradle\caches\transforms-3\c0f72543522d58f6469d8bcfc9faeb00\transformed\ui-text-1.2.0-runtime\classes.dex

Ответить
@xmaster9841
@xmaster9841 - 17.07.2023 23:08

How can i push this data to ViewModel?

Ответить
@omarhaddad980
@omarhaddad980 - 25.06.2023 17:37

I found that calling `stop()` before even attempting to start will cause a problem. The reason I'm sharing this is because I'm trying to implement a `restartLocationTracking()` feature. It's essentially a location tracking refresher that involves calling `stop()` and then `start()`. This feature is particularly important when developing a Hybrid cross-platform app using Ionic and Capacitor. Is there a way to check if the (location is being tracked) before we call `stop()`?

Ответить
@rustamsafarov
@rustamsafarov - 17.06.2023 19:30

best

Ответить
@dallasrieck7753
@dallasrieck7753 - 16.06.2023 03:16

testing
🙃

Ответить
@dallasrieck7753
@dallasrieck7753 - 16.06.2023 03:07

how about share and not tutorial

Ответить
@dallasrieck7753
@dallasrieck7753 - 15.06.2023 18:45

share not tutorial; someone shared this with you

Ответить
@dallasrieck7753
@dallasrieck7753 - 15.06.2023 18:27

i hope you "learned" something here

Ответить
@dallasrieck7753
@dallasrieck7753 - 15.06.2023 18:27

and, why do you say "ya" ? no one asked you a question!

Ответить
@dallasrieck7753
@dallasrieck7753 - 15.06.2023 18:25

how about "share" not "tutorial", afterall, someone shared it with you

Ответить
@sambalsrivastava6660
@sambalsrivastava6660 - 08.06.2023 12:54

how can we launch this foreground service for android 12 and above while the app is in background or closed, I tried using combination of work manager and exactAlarm but still I am getting ForegroundServiceStartNotAllowedException. Please tell as this is very important for my app. Thanks a lot!

Ответить
@berkc5323
@berkc5323 - 05.06.2023 15:19

Why did you use launch { send() } instead of trySend()? Is it okay to launch a new coroutine every time that location callback triggers?

Ответить
@salmaK20012
@salmaK20012 - 25.05.2023 15:00

YOU ARE A LIFE SAVER!

Ответить
@deepfuchsia7204
@deepfuchsia7204 - 14.05.2023 18:28

Hey Philipp, thanks for the video and the code. I had problems with foreground service and your code worked perfectly fine.
I have an additional question tho.
Let's say we want to render a map and a polyline which would render something like a path using the list of locations gathered over time.
The map is rendered inside a @Composable. What's the best way to pass the location data from the service into the @Composable, so it can render the path?

Ответить
@raojilani3103
@raojilani3103 - 02.05.2023 22:31

thank you thank you so much for this help

Ответить
@florianaleman9120
@florianaleman9120 - 21.04.2023 18:27

Hey great tutorial.
I have some trouble getting the location in background idf i dont implement the code for the notifications. Is it possible ?

Ответить
@faxmodem2397
@faxmodem2397 - 13.04.2023 06:57

Hello, how can we save this information and send it to the backend? And the second question is how can we send an alarm to the backend when the user turns off the GPS

Ответить
@yugmewada4339
@yugmewada4339 - 12.04.2023 21:00

Why you have used flow? Why you cant used mutable live data of Location?

Ответить
@yugmewada4339
@yugmewada4339 - 12.04.2023 20:59

I am working on android kotlin food delivery project i have order tracking screen in which path will be drawn and customer can track the driver’s location application support is 6-12 than what will the best way to do above defined job? I have to send updated lat long to api to suggest me accordingly

Ответить
@leolima8585
@leolima8585 - 12.04.2023 20:43

Mostra sem uso de compose, acho um lixo o google ter dezenas de forma de fazer algo, e constantemente depreciado a cada 6 meses, eu tenho nojo desta empresa de engenharia chamada GOOGLE

Ответить
@alencerimagic9292
@alencerimagic9292 - 10.04.2023 17:19

Hello Philipp, I truly enjoyed your video and appreciate your effort in educating others. I am currently exploring the integration of beacon technology into my app, but I have encountered a problem where iPhones can wake up by beacons, but Androids cannot. In an attempt to address this, I have implemented Geofencing, where I initiate a search for Bluetooth devices for a limited time in a Foreground service, once a user enters a geofence area. However, you mentioned that obtaining approval for using background location can be quite challenging. Would you happen to have any suggestions for a workaround that would enable me to detect beacons without the need to keep a Foreground service active continuously?

Ответить
@xomeluha5837
@xomeluha5837 - 10.04.2023 10:09

Hey Phillip Thanks for this tutorial. It will be helpful if you can make a tutorial on how to show user's trip history with snapToRoad functionality

Ответить
@roshkaalex
@roshkaalex - 27.03.2023 12:35

Hi Philipp. What about ACCESS_BACKGROUND_LOCATION permission? Should we use this permission for tracking in background?

Ответить
@GirishKumar-vj6yy
@GirishKumar-vj6yy - 25.03.2023 11:43

Thanks Bro😊

Ответить
@pranjalisrivastava6170
@pranjalisrivastava6170 - 24.03.2023 01:02

How to play navigation sound when navigation started to confirm that voice directions are working in android studio?

Ответить
@devstuff2576
@devstuff2576 - 15.03.2023 10:11

Would be more helpful if you showed how to then use this data on the activity ...not just display a notification.

Ответить
@joaopaulopop
@joaopaulopop - 12.03.2023 19:49

Thank you very much!

Ответить
@michaelremme8319
@michaelremme8319 - 08.03.2023 23:50

Really really great, what you did. It was exactly what i was searching for ( for nearly a week of search ). Transfer into java was not that complicated.
I have one question: why are you building the NorificationChannel inside the Application? I found some others, which are building it inside the Service directly. In that way it seems that they are recreating it with each location update. Cause of this?

Ответить
@elgracko
@elgracko - 08.03.2023 08:11

Oh, this worked perfectly, thanks!! you have no idea how much this helps!!

I'm definetly buying you that coffee, right now|

Ответить
@dineshfurry4661
@dineshfurry4661 - 06.03.2023 18:45

IS THIS KOTLIN BRO???

Ответить