Questions tagged [foreground]

Mostly refers to an application or an element that is in the front of a view.

In computer science the term Foreground is mostly used to describe:

  • An application that appears in front of the screen.
  • Front part of an element (e.g. text of a button).
682 questions
446
votes
45 answers

How to detect when an Android app goes to the background and come back to the foreground

I am trying to write an app that does something specific when it is brought back to the foreground after some amount of time. Is there a way to detect when an app is sent to the background or brought to the foreground?
iHorse
  • 4,479
  • 3
  • 15
  • 4
383
votes
34 answers

Context.startForegroundService() did not then call Service.startForeground()

I am using Service Class on the Android O OS. I plan to use the Service in the background. The Android documentation states that If your app targets API level 26 or higher, the system imposes restrictions on using or creating background services…
NiceGuy
  • 3,866
  • 2
  • 9
  • 10
166
votes
5 answers

How do I update the notification text for a foreground service in Android?

I have a foreground service setup in Android. I would like to update the notification text. I am creating the service as shown below. How can I update the notification text that is setup within this foreground service? What is the best practise…
Luke
  • 6,195
  • 11
  • 57
  • 85
109
votes
16 answers

How to startForeground() without showing notification?

I want to create a service and make it run in the foreground. Most example codes have notifications on it. But I don't want to show any notification. Is that possible? Can you give me some examples? Are there any alternatives? My app service is…
88
votes
2 answers

Foreground service being killed by Android

Update: I have not found a true solution to the problem. What I did come up with was a method of automatically reconnecting to a previous bluetooth device anytime the connection is lost. It's not ideal, but it seems to work fairly well. I'd love…
howettl
  • 12,419
  • 13
  • 56
  • 91
63
votes
5 answers

Is there a foreground equivalent to background-image in css?

I want to add some shine to an element on webpage. I would prefer if I don't have to add additional html to the page. I want the image to appear in front of the element rather than behind. What's the best way to do this?
Himmators
  • 14,278
  • 36
  • 132
  • 223
59
votes
6 answers

startForeground() does not show my Notification

I am trying to make my Service running in foreground. I tried to use this example (please look for the section "Running a Service in the Foreground"), but startForeground() does not actually show my notification. And no exceptions is thrown. To make…
Dmitry Frank
  • 10,417
  • 10
  • 64
  • 114
57
votes
2 answers

Foreground Vs Active window

In Windows, what is the difference between foreground and active window? To be specific, under what circumstances can a foreground window not be an active window? If the 2 terms are referring to the same concept why there're 2 terms. The msdn…
JavaMan
  • 4,954
  • 4
  • 41
  • 69
37
votes
3 answers

Determine if an app is running in the foreground when a notification is received on iOS

I would like to find a way to see what app is running in foreground or if the home screen is displayed when a local notification from my app show up. For example i want to have different actions if there is in homescreen or in someone else app. I…
user1117453
  • 475
  • 1
  • 5
  • 8
37
votes
7 answers

How to determine if an Android Service is running in the foreground?

I have a service which I believe to have running in the foreground, How do I check if my implementation is working?
user811985
  • 503
  • 1
  • 5
  • 10
36
votes
7 answers

iOS NSNotificationCenter to check whether the app came from background to foreground

I have a situation in which i have to intialize an object everytime when it comes from background to foreground and that should be using the NSNotificationCenter not with appdelegate because iam building a static library so there wont be appdelegate…
user3115014
  • 667
  • 1
  • 8
  • 23
36
votes
4 answers

iOS: Keep an app running like a service

In iOS, how would I instruct the OS to keep my app running even if it is no longer in the foreground? Skype Viber Empatica Zenly And many more apps does this.
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
33
votes
5 answers

How to disable iPhone/iPad auto-lock while app is in foreground mode?

I'm developing an music/video player app and just need to konw how to disable the auto-lock while my app is in foreground. I know I've to use [[UIApplication sharedApplication] setIdleTimerDisabled:YES]; and [[UIApplication sharedApplication]…
jMelnik
  • 1,055
  • 2
  • 15
  • 26
33
votes
7 answers

Bring window to front -> raise(),show(),activateWindow() don’t work

In my Qt-application I open a URL in the default-browser. Afterwards I want to bring the main-window of my application to the front again. I tried all approaches I could find but none worked. All it does is blink in the taskbar (of Window 7) Here’s…
Hedge
  • 16,142
  • 42
  • 141
  • 246
30
votes
2 answers

WPF Label Foreground Color

I have 2 Labels in a StackPanel and set a Foreground color to both of them... The second one shows as black, when it shouldn't.
JuHwon
  • 2,033
  • 2
  • 34
  • 54
1
2 3
45 46