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
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.
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.............
Thanks you so much! I write rare in comments but always thumb up, cause i like your explanation style, clean speech, and in the end when you summary all what we have done in this part, make sure for brain that this part exactly understood obviously) Dont stop to do this great staff, and im sure you are going be one of the best Android teacher in UA-cam. Good luck! ;)
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)
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.
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
Why can't we create getTrac kingPendingIntent() in setContentIntent instead of using getMainActivityPendingIntent() and then launching TrackingFragment.
Sure, we could do that, but then our code starts to become really messy. You should always try to structure it in functions that tell you what they do. Later we will also inject this pending intent with dagger hilt
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.
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.
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
Hi bro, I watched your tutorials it was awesome, but I found problem regarding the foreground service. When I run the foreground service while the screen is on, it works perfectly fine. But the moment when I off the screen with in few minutes android kills the foreground service I am using Huawei honor 9.1.0.168 (android pie) I am aware of dontkillmyapp.com I could fix that problem in the power saver settings. But that takes an additional step for user. Please reply me if you found any solution without that additional step in settings, it could help not only for my project but also for building new foreground service package in flutter, so that it could be helpful for other flutter developers as well. Anyway this is a wonderful series. Thank a lot from Indian developer
What I've heard is that some Chinese devices even kill foreground services. In that case you can't do too much about it, but I also haven't encountered that problem
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?
@@PhilippLackner That's odd. I've read blogs where developers mostly complain about One Plus and Huawei. Maybe the model and make matter. Also my phone is running out of internal memory but would it affect the foreground service? I thought it was only dependant on RAM..
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
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.
one of my fav youtuber
Thanks mate!
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.............
Wow, thank you!
Thanks you so much! I write rare in comments but always thumb up, cause i like your explanation style, clean speech, and in the end when you summary all what we have done in this part, make sure for brain that this part exactly understood obviously) Dont stop to do this great staff, and im sure you are going be one of the best Android teacher in UA-cam. Good luck! ;)
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)
The perfect android tutorials do exist
my favorite teacher really you Deserve all the support
Thank you man❤️
Now I'm clear in foreground and background services with notification and navigation Intent :) nice explanation brother.
Great, happy to help! 👍
you could use deeplink to navigate to a specific fragment
Kudos , This is really helping me to move to kotlin and new Architecture .Thank you
Thanks, you're welcome!
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.
I can't believe I never saw this channel before.
You deserve my Subscription.
Keep up the good work!
Wow, thanks!
@@PhilippLackner Twitter handler?
Top Notch Explanation about pending intent
Wow that was great explantation, keep going from London
Awesome tips, that was the best 2:57
Very good and clear explanation on foreground service and notification. Thank you!!
Glad it was helpful!
Thank you very much for your free course and the valuable time that you spent to educate people.As you said I disabled AdBlock.
You're awesome Philipp, I'd like to watch this video thousand times again and again! seriously! :))))
Thank you!!
Amazing explanation and example, thank you Philipp!
You're a bad man. I love you bro. My fingers are itchy, time to code
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
Thank you Phillip! very useful content!
Simply Awesome kudos to explination
Thanks you very much! Very good tutorial. Is there a way to implement this for API Level 17 (below OREO, without notificationmanager)
Great tutorial, you really make complex easy
Learned alot of new thing dude thanks for this series.
you're welcome :)
Great tutorial! I appreaciate your work so much!
why singleTop is needed if you have already set "singleTask" launch mode in the manifest file?
Super informative video
Why can't we create getTrac
kingPendingIntent() in setContentIntent instead of using getMainActivityPendingIntent() and then launching TrackingFragment.
Sure, we could do that, but then our code starts to become really messy. You should always try to structure it in functions that tell you what they do. Later we will also inject this pending intent with dagger hilt
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.
What about a download notification with ETA and a cancel button?
Great Tutorial
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.
Cool, didn't know that
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
Very helpful video , thank you
Great tutorial, but how do you import your constants? I can only complete with the class prefixed...
Alt + Enter on windows
Hi bro,
I watched your tutorials it was awesome, but I found problem regarding the foreground service. When I run the foreground service while the screen is on, it works perfectly fine. But the moment when I off the screen with in few minutes android kills the foreground service
I am using Huawei honor 9.1.0.168 (android pie)
I am aware of dontkillmyapp.com I could fix that problem in the power saver settings. But that takes an additional step for user.
Please reply me if you found any solution without that additional step in settings, it could help not only for my project but also for building new foreground service package in flutter, so that it could be helpful for other flutter developers as well.
Anyway this is a wonderful series. Thank a lot from Indian developer
What I've heard is that some Chinese devices even kill foreground services. In that case you can't do too much about it, but I also haven't encountered that problem
Okay @@PhilippLackner thanks for your replay
amazing bro !!
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?
Same shit. Did you find a solution?
Thank you 🙏
Epic!
I love you how I never had loved before
Top 👏👏👏👏
Thank you :)
Great Video!!
Thanks!
You're great bro!
Thanks buddy!
why when I close the application the notification is gone(real device).
Because you closed it, you kill the app and the service with it. Try that with Spotify and you will experience the same
@@PhilippLackner but in the emulator when the application is closed the notification is still there
👏👏👏👏
thanks
Exactyl what i needed
for who face foreground service permission error for api 28+
Add this to manifest :
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 !
kotlin.TypeCastException: null cannot be cast to non-null type androidx.navigation.fragment.NavHostFragment
BOMB!!!
Nice Tutorial, can you provide this in Java ?
My Oppo kills all the foreground services. Say hello to Chinese manufacturers
I also have a chinese phone (OnePlus) and for me it works fine
@@PhilippLackner That's odd. I've read blogs where developers mostly complain about One Plus and Huawei. Maybe the model and make matter. Also my phone is running out of internal memory but would it affect the foreground service? I thought it was only dependant on RAM..