The operating system notifies an app whenever it moves between the foreground and background. These notifications enable to modify the app’s behavior during focus change.
Questions tagged [foregroundnotification]
71 questions
23
votes
3 answers
Android 12 - Foreground service launch restrictions
I'm developing an SDK that needs to startForeground service from the background. Because it uses background location and Bluetooth-related works. If the application is killed, the monitoring is performing in the background. That's why I'm using the…

jerald jacob
- 613
- 1
- 4
- 18
9
votes
5 answers
Notification not showing up when app is open
Notification is not showing when app is running.
It works when app is closed.
MyFirebaseMessagingService.java
public class MyFirebaseMessagingService extends FirebaseMessagingService {
private static final String TAG =…

Unnati Patadia
- 662
- 3
- 19
- 39
9
votes
2 answers
Oreo - Starting a service in the foreground
I have created a service that tracks the device's location as it moves. The service is started in by an Activity that binds to it, and in this activity there is a "Start Tracking" button. When this button is pressed, I need the service to start in…

KOB
- 4,084
- 9
- 44
- 88
8
votes
1 answer
RemoteServiceException: Context.startForegroundService did not then call Service.startForeground
I get the following exception output from Device Monitor:
//FATAL EXCEPTION: main
//Process: com.xxx.yyy, PID: 11584
//android.app.RemoteServiceException: Context.startForegroundService() did not then call Service.startForeground()
// at…

Pierre
- 8,397
- 4
- 64
- 80
6
votes
0 answers
How to fix "Bad notification" error happening because of "Couldn't inflate contentViews java.util.ConcurrentModificationException"?
Few crashes are being reported in my production android app with the following stack traces. I tried googling and search through StackOverflow but could not figure out what might be causing it. From the looks of the exception being reported, should…

Ankit Batra
- 823
- 9
- 16
6
votes
0 answers
multiple notifications in a foreground worker
I am using a worker manager to upload videos along with a notification. When the user tries to upload a video again with an ongoing upload worker job the notification for the second upload is not shown even though the work is being executed. I am…

Krishna Saladi
- 61
- 3
6
votes
1 answer
My foreground service is killed on some devices like vivo after killing app?
My foreground service is killed on some devices like vivo after killing app, is there any workaround to keep it alive?
I am using foreground service like:
public class MyService extends IntentService {
private final String TAG =…

Anurag Mishra
- 139
- 7
6
votes
2 answers
Foreground notification service not working in one plus devices
Below is the code for starting the foreground service.
It is working fine for many devices like Samsung, moto, Vivo, Oppo and also with Android version nougat and oreo, but not working on One plus devices.
Can anyone let me know if any extra changes…

surbhi verma
- 357
- 4
- 11
6
votes
1 answer
Forgeround service stop after a few minutes or locking the phone
I try to create foreground service that toast a message every 20 second but this service stop after a few minutes or locking the phone.
I test this service in android 8 (O).
my code is :
@Override
public int onStartCommand(Intent intent, int flags,…

h.hejabi
- 85
- 1
- 9
5
votes
0 answers
Foreground Service killed by android OS
I have a Foreground Service and on Samsung devices android OS kills my Foreground Service after a week or two .
I have a fitness app that runs Foreground Service 24 hours and it will not be destroyed.
In OnCreate() and OnStartCommand() method of a…

saim malik
- 51
- 2
5
votes
1 answer
Service stopForeground(false) remove notification when should not
Instead of
stopForeground(true)
calling,
stopForeground(false)
should retain the notification as it is (without ongoing state) unless it is dismissed by user/removed programmatically.
This also should prevents notification flashing since I am…

Jonathan I
- 240
- 1
- 4
- 18
5
votes
0 answers
android 8 foreground service system notification "is running in the background"
I've got foreground service targeting android 8. There is service notification like "voip service runnig" when some app activity is visible.
The problem is that when app goes background, android show additional system notification "App is running in…

user1167302
- 53
- 1
- 3
5
votes
2 answers
Swipe to dismiss notification on foreground service
I'm trying to dismiss a notification from the foreground service but yet find any solutions. I'm not using notificationManager.notify(...) but startForeground(...) instead.
My NotificationCompat.Builder
Intent actionCancelNotification = new…

Krot
- 187
- 3
- 13
3
votes
0 answers
Fatal Exception: android.app.ForegroundServiceDidNotStartInTimeException
Fatal Exception: android.app.ForegroundServiceDidNotStartInTimeException: Context.startForegroundService() did not then call Service.startForeground(): ServiceRecord{294bdda u0 com.xyz.xyz/com.xyz.pushnotification.BookingProgressService}
at…

mbpatel
- 501
- 1
- 5
- 19
3
votes
0 answers
Notification is not showing with workmanager foregroundInfo
I wanted to create a notification with heads up feature . Basically it is a alarm feature. And I wanted to show with notification using foreground. Now workmanager has the feature to run in foreground using setForeground . But it's not showing…

Jeevan Rupacha
- 3,055
- 1
- 15
- 29