Context:
I have been using Google's LocationUpdatesForegroundService example project to learn a bit more about services.
I have downloaded the project via Github desktop and ran it on my phone, everything is great and the project does what it's intended to do.
My phone is Android 8.0.0, API 26
Problem:
The foreground service notification shows up on the status bar once the app is terminated, as soon as that happens I hear a notification sound(default sound). However, I would like the notification to be silent, like in some location-based apps(eg: Life360)
What I've tried so far:
- in LocationUpdatesService.java at added
159
triedmChannel.setSound(null,null);
- in LocationUpdatesService.java at line
296
changed.setPriority(Notification.PRIORITY_HIGH)
to.setPriority(Notification.PRIORITY_LOW)
- in LocationUpdatesService.java at line
158
changedNotificationManager.IMPORTANCE_DEFAULT
toNotificationManager.IMPORTANCE_LOW)
- in LocationUpdatesService.java at line
300
addedsetSound(null)
None of the above have worked for me, I would really appreciate if someone could shed some light on this situation.