Making Our Service a Foreground Service - MVVM Running Tracker App - Part 12

Making Our Service a Foreground Service - MVVM Running Tracker App - Part 12

Philipp Lackner

4 года назад

28,728 Просмотров

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


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

@dmytrodolotov9723
@dmytrodolotov9723 - 20.12.2023 15:07

Before starting service from the fragment it also make sense to check if Notifications are NOT disabled for this app and Backround Mode is allowed as well. Otherwise - show dialog that navigates the user to the Settings. (Similar to EasyPermission logic)

Ответить
@seriousinjaehun
@seriousinjaehun - 04.08.2023 10:50

If you try to follow this tutorial in 2023, you need to fix some points by yourself. In TrackingService, PendingIntent needs not only FLAG_UPDATE_FRAGMENT but also FLAG_IMMUTABLE. And notification system has been changed a lot. At least you have to add POST_NOTIFICATIONS permission to manifest.

Ответить
@diamantto
@diamantto - 29.03.2023 16:10

Anyone, who are doing this course and get crashing after activity was closed. As i using databinding, my navHostFragment looks like:
navHostFragment = supportFragmentManager.findFragmentById(R.id.navHostFragment) as NavHostFragment

So, i did "private lateinit var navHostFragment: NavHostFragment" before OnCreate() and calling "navigateToTrackingFragmentIfNeeded(intent)" in OnCreate() after i initializing navHostFragment

Ответить
@VeskoLatchev
@VeskoLatchev - 02.03.2023 22:41

For those who struggle with android 13

1.Just add POST_NOTIFICATIONS and FOREGROUND_SERVICE permissions to manifest.

2. Add request permission at runtime (for POST_NOTIFICATIONS) before sendCommandToService

Ответить
@VeskoLatchev
@VeskoLatchev - 02.03.2023 16:51

Amazing explanation and example, thank you Philipp!

Ответить
@oswaldodejesus2753
@oswaldodejesus2753 - 03.02.2023 21:34

Hello @Phi, I hope you are well, thank you very much for your content, it has helped me a lot.

On the other hand I am implementing this notification logic but I am using jetpack compose and I don't know how to launch the onNewIntent from compose, if you can offer me a guide I would really appreciate it.

Ответить
@thecodemonk2481
@thecodemonk2481 - 06.07.2022 10:57

why singleTop is needed if you have already set "singleTask" launch mode in the manifest file?

Ответить
@eugentorkin4654
@eugentorkin4654 - 25.06.2022 18:48

Thanks you very much! Very good tutorial. Is there a way to implement this for API Level 17 (below OREO, without notificationmanager)

Ответить
@osmanmusse9432
@osmanmusse9432 - 12.04.2022 04:22

Wow that was great explantation, keep going from London

Ответить
@arcadudu
@arcadudu - 15.03.2022 16:58

Thank you Phillip! very useful content!

Ответить
@novocanal7153
@novocanal7153 - 20.01.2022 04:19

When I click on the notification, it's opening a new instance of the activity, instead of opening the one already running. Does anyone know how to solve?

Ответить
@jasolsodha7569
@jasolsodha7569 - 08.07.2021 09:38

Great Tutorial

Ответить
@sergio0reblp75
@sergio0reblp75 - 10.06.2021 09:57

I love you how I never had loved before

Ответить
@FrenchWithIliass
@FrenchWithIliass - 30.05.2021 17:10

in 15 minutes the service was killed. Please I want to run a service that will not be killed
because I want to check changes from a server and notify a user. How Can I do that

Ответить
@shreyashchoudhary7413
@shreyashchoudhary7413 - 30.05.2021 13:31

Epic!

Ответить
@amineayachi335
@amineayachi335 - 27.05.2021 13:06

Hello Philipp there is a problem with foreground service in some devices there is a saving battery mode called (ultra power saving mode) that kill all services even the foreground service after the mode is turned off there is no way to tell the foreground service to restart again automatically even broadcast receivers will not work anymore after that mode like bootcomplited please if you can help i will be very thankful

Ответить
@murmure1003
@murmure1003 - 17.05.2021 19:12

clicking on notfication always keep me back to my home fragment .. Android don't give a f... about my graph action ... I'm turning mad !

Ответить
@moriz8549
@moriz8549 - 02.05.2021 21:14

awesome android tutorial. you explain every detail of any function which is GREAT ❤, so we don't need to pause the video in order to do some research about it.

Ответить
@mooncrowned
@mooncrowned - 16.04.2021 14:33

The perfect android tutorials do exist <3

Ответить
@farhad9579
@farhad9579 - 12.02.2021 23:14

for who face foreground service permission error for api 28+
Add this to manifest :
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />

Ответить
@brucebane7401
@brucebane7401 - 06.02.2021 12:08

amazing bro !!

Ответить
@chewataapp7021
@chewataapp7021 - 26.01.2021 20:00

What about a download notification with ETA and a cancel button?

Ответить
@EyosiB
@EyosiB - 26.01.2021 10:18

I can't believe I never saw this channel before.
You deserve my Subscription.
Keep up the good work!

Ответить
@mohammadnoorhossain126
@mohammadnoorhossain126 - 28.12.2020 20:16

Nice Tutorial, can you provide this in Java ?

Ответить
@yashponam1055
@yashponam1055 - 24.12.2020 19:55

Exactyl what i needed

Ответить
@OlivierGeorg
@OlivierGeorg - 22.12.2020 18:14

Great tutorial, but how do you import your constants? I can only complete with the class prefixed...

Ответить
@pablocruz1302
@pablocruz1302 - 08.11.2020 04:17

Great tutorial, you really make complex easy

Ответить
@alirohmansyah7914
@alirohmansyah7914 - 15.10.2020 08:33

why when I close the application the notification is gone(real device).

Ответить
@kiranrayala9939
@kiranrayala9939 - 09.10.2020 06:53

Simply Awesome kudos to explination

Ответить
@ali_soleimani_r
@ali_soleimani_r - 24.09.2020 10:51

You're awesome Philipp, I'd like to watch this video thousand times again and again! seriously! :))))

Ответить
@dawoodamir2011
@dawoodamir2011 - 22.09.2020 19:12

Learned alot of new thing dude thanks for this series.

Ответить
@abdelrahmanesam3684
@abdelrahmanesam3684 - 05.09.2020 21:04

my favorite teacher really you Deserve all the support

Ответить
@alroygama6166
@alroygama6166 - 02.09.2020 09:18

Super informative video

Ответить
@kurok1132
@kurok1132 - 19.08.2020 06:34

Very good and clear explanation on foreground service and notification. Thank you!!

Ответить
@gajendrapandeya5081
@gajendrapandeya5081 - 17.08.2020 19:27

Are you magician? You really blown me away with your explanation. How could you be so clear and precise while explaining. Just really awesome. Enjoying a lott.............

Ответить
@florez190386
@florez190386 - 05.08.2020 22:07

you could use deeplink to navigate to a specific fragment

Ответить
@Kamkle65
@Kamkle65 - 05.08.2020 00:01

Great tutorial! I appreaciate your work so much!

Ответить
@JujareVinayak
@JujareVinayak - 04.08.2020 11:17

Why can't we create getTrac
kingPendingIntent() in setContentIntent instead of using getMainActivityPendingIntent() and then launching TrackingFragment.

Ответить
@imnithish
@imnithish - 23.07.2020 23:38

You're great bro!

Ответить
@anirudhganesh
@anirudhganesh - 22.07.2020 16:50

setAutoCancel and setOnGoing don't seem to be necessary if you're starting a foreground service. I was running the foreground service without these options and notification was not swipable nor did it disappear when clicked.

Ответить
@anirudhganesh
@anirudhganesh - 22.07.2020 16:38

My Oppo kills all the foreground services. Say hello to Chinese manufacturers

Ответить
@simonegli3622
@simonegli3622 - 21.07.2020 11:42

Great Video!!

Ответить
@mustafashaikh7829
@mustafashaikh7829 - 21.07.2020 11:30

Now I'm clear in foreground and background services with notification and navigation Intent :) nice explanation brother.

Ответить
@kumarbharani2718
@kumarbharani2718 - 20.07.2020 04:41

Top Notch Explanation about pending intent

Ответить
@AlgeriaHere
@AlgeriaHere - 09.07.2020 17:39

Very helpful video , thank you

Ответить