Комментарии:
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)
Ответить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.
Ответить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
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
Amazing explanation and example, thank you Philipp!
Ответить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.
why singleTop is needed if you have already set "singleTask" launch mode in the manifest file?
ОтветитьThanks you very much! Very good tutorial. Is there a way to implement this for API Level 17 (below OREO, without notificationmanager)
ОтветитьWow that was great explantation, keep going from London
ОтветитьThank you Phillip! very useful content!
Ответить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?
ОтветитьGreat Tutorial
ОтветитьI love you how I never had loved before
Ответить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
Epic!
Ответить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
Ответить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 !
Ответить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.
ОтветитьThe perfect android tutorials do exist <3
Ответитьfor who face foreground service permission error for api 28+
Add this to manifest :
<uses-permission android:name="android.permission.FOREGROUND_SERVICE" />
amazing bro !!
ОтветитьWhat about a download notification with ETA and a cancel button?
ОтветитьI can't believe I never saw this channel before.
You deserve my Subscription.
Keep up the good work!
Nice Tutorial, can you provide this in Java ?
ОтветитьExactyl what i needed
ОтветитьGreat tutorial, but how do you import your constants? I can only complete with the class prefixed...
ОтветитьGreat tutorial, you really make complex easy
Ответитьwhy when I close the application the notification is gone(real device).
ОтветитьSimply Awesome kudos to explination
ОтветитьYou're awesome Philipp, I'd like to watch this video thousand times again and again! seriously! :))))
ОтветитьLearned alot of new thing dude thanks for this series.
Ответитьmy favorite teacher really you Deserve all the support
ОтветитьSuper informative video
ОтветитьVery good and clear explanation on foreground service and notification. Thank you!!
Ответить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.............
Ответитьyou could use deeplink to navigate to a specific fragment
ОтветитьGreat tutorial! I appreaciate your work so much!
ОтветитьWhy can't we create getTrac
kingPendingIntent() in setContentIntent instead of using getMainActivityPendingIntent() and then launching TrackingFragment.
You're great bro!
Ответить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.
ОтветитьMy Oppo kills all the foreground services. Say hello to Chinese manufacturers
ОтветитьGreat Video!!
ОтветитьNow I'm clear in foreground and background services with notification and navigation Intent :) nice explanation brother.
ОтветитьTop Notch Explanation about pending intent
ОтветитьVery helpful video , thank you
Ответить