I have an application that uses another library to enter password to get into the app.
It starts my.package.MainActivity
and if it is locked, it will show different.lib.package.MainActivity
to get password. Then it resumes to my.package.MainActivity
, loads data from API and shows them.
You can show some of the data on the widget on the homescreen (here, it doesn't need password). These data are updated every +- hour from running service my.package.MyService.
When my.package.MainActivity
is on the foreground, my.package.MyService
is running on the background and updating data correctly.
When my.package.MainActivity
on the background, my.package.MyService
is started as foreground service and notification is shown to user about that. As I understood this is how it works on Oreo.
So.. when different.lib.package.MainActivity
is shown I have to run service as foreground service. Otherwise I am getting
java.lang.IllegalStateException:
Not allowed to start service Intent, app is in background.
Is it possible to stop showing this notification while different.lib.package.MainActivity
is on the foreground? Or I have to show notification because it is from different package? I have trouble with this because from user point of view it looks like one app is on the foreground and notification shows that the same app is running on the background.
(it is an old and huge application I am maintaing)