confused_at_times
confused_at_times

Reputation: 545

Stop routine Service start from bringing an existing background process to foreground

I have an app with a service that polls at set intervals using the AlarmManager, and when the main app activity is active on screen. The issue I have is, if the app's process is in the background (has not been killed) and the service begins to poll, it brings the main app activity to the foreground.

How do I stop this from happening? Essentially, I want all of the app's processes to remain in the background, unless the user chooses otherwise.

Thanks

Upvotes: 0

Views: 180

Answers (1)

CommonsWare
CommonsWare

Reputation: 1006564

The issue I have is, if the app's process is in the background (has not been killed) and the service begins to poll, it brings the main app activity to the foreground.

Then you are calling startActivity(), or possibly startForeground() (I'm not aware that startForeground() would push an existing task to the foreground, but I haven't tried it and cannot rule it out).

Upvotes: 1

Related Questions