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).
635 questions
409
votes
44 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,109
  • 3
  • 13
  • 4
308
votes
30 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,116
  • 2
  • 7
  • 10
147
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
  • 5,895
  • 11
  • 54
  • 84
95
votes
15 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…
87
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
  • 11,761
  • 13
  • 54
  • 88
56
votes
4 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
  • 12,918
  • 30
  • 111
  • 198
55
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
  • 9,453
  • 7
  • 55
  • 101
49
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,494
  • 4
  • 34
  • 62
35
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
  • 455
  • 1
  • 5
  • 8
32
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
  • 60,720
  • 99
  • 311
  • 535
31
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,035
  • 2
  • 15
  • 26
30
votes
6 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
  • 433
  • 1
  • 5
  • 10
30
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
  • 607
  • 1
  • 7
  • 21
28
votes
2 answers

iOS how to judge application is running foreground or background?

As we all knows, if an iOS app is running foreground, then the app won't notify users when the remove notification come. Now In my app, I want to show alert to notify users that remote notification comes. How to judge if the app is running…
Smeegol
  • 1,609
  • 4
  • 26
  • 40
27
votes
6 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
  • 13,498
  • 35
  • 122
  • 223
1
2 3
42 43