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

preview_player
Показать описание
Tracking the user's location in Android is often needed when your app is minimized. Thanks to foreground services that works really well and without many restrictions. In this video I'll show you how.

⭐ Get certificates for your future job
⭐ Save countless hours of time
⭐ 100% money back guarantee for 30 days
⭐ Become a professional Android developer now:

💻 Let me be your mentor and become an industry-ready Android developer in 10 weeks:

Subscribe to my FREE newsletter for regular Android, Kotlin & Architecture advice!

Join this channel to get access to perks:

Get the source code for this video here:

Join my Discord server:

You like my free content? Here you can buy me a coffee:
Рекомендации по теме
Комментарии
Автор

How can I be so lucky I just had a project with background tracking and here it is by best teacher like him on youtube .❤

sahilkanabar
Автор

Congrats!! Really good tutorial, well explained and keeping it as simple as possible

juansuarez
Автор

"To provide a streamlined experience for short-running foreground services, devices that run Android 12 or higher can delay the display of foreground service notifications by 10 seconds, with a few exceptions. This change gives short-lived tasks a chance to complete before their notifications appear." - Android Docs, if anyone was curious about that weird delay behavior

lifebylazy
Автор

I think we may be able to improve upon the DefaultLocationClient class by putting all the locationmanager checking methods and also the context extension function into usecase classes that are wrapped by interfaces and the DefaultLocationClient class would depend upon those. That way you could unit test the class better by providing different mock implementations for the interfaces so if you would want to write a test case that checks the output if for example the gps is enabled but the location is not, then that way you could easily do that. It might be overkill but I think every unit test in itself could seem like an overkill. Just my two cents.

BapeRuLLZ
Автор

Android gives continuous pain by continuous changing android SDK

muhammadirfanrajput
Автор

What a great video, helps A LOT in the beginning.

chabbishreels
Автор

Thank you Philipp for this wonderful video.

learner
Автор

Nice video, we have this setup in our app, albeit implemented before the introduction of flows.

If you "take requests" for future videos, I would love to see your approach to handling automatic startup of these types of services when a BLE device is present. Our devices requires physical activation and for our app to be ready for this, we have to keep a sticky notification at all times which is ugly. There are workarounds to use "companion devices", but the support for proximity to BLE devices seems limited to the latter two (?) Android versions. It would be interesting to see how you would handle the "do stuff when in proximity"-approach for both newer Android devices as well as for older.

halvtysk
Автор

you r going to catch 100k soon :D i noticed it from the 2 days it add +100 on regular but today it +200 so soon 😃👏

KhadijaHameed-bxmt
Автор

send(location), exactly how khabib said it. Thanks again @Philipp

maximooze
Автор

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

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

elgracko
Автор

Thank you brother, you made our life easy.

PrabhatPandey-jkur
Автор

Very cool video
Thank You Bro
Wish you all the best

mustafaammar
Автор

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

AnkitKumar-ddfo
Автор

Hello! Can we unit test for FusedLocationProviderClient using mock? or we have to write ui test for it?

mukammart
Автор

hi philip, great video, I was wondering if you had any suggestion for using a default location listener instead of fused location, i need my app to work without play services, thanks

Giulyozz
Автор

Nice video, Thank you for your source code. it has useful to my develop about show location.

SengKuz
Автор

Can you make a tutorial on complex survey form using json. Mean to say that the form is dynamically created from server end json response with multiple different layouts like rating bar, editext, radiobutton, spinners

aviksutar
Автор

nice tutorial. qq, what is the difference between foreground service vs WorkerManager?

EmanNollase
Автор

Thank you Philipp🔥
Could you make a tutorial about How to observe new data in the backgroud and then fire a notificarion.

BEST WISHES

Adam