Questions tagged [background-service]

A background service is a computer service that runs "behind the scenes" (i.e. in the background) and without user intervention.

694 questions
229
votes
10 answers

startForeground fail after upgrade to Android 8.1

After upgrading my phone to 8.1 Developer Preview my background service no longer starts up properly. In my long-running service I've implemented a startForeground method to start the ongoing notification which is called in on…
Rawa
  • 10,673
  • 6
  • 33
  • 52
111
votes
9 answers

Android Starting Service at Boot Time , How to restart service class after device Reboot?

I need to start a service at boot time. I searched a lot. They are talking about Broadcastreceiver. As I am new to android development, I didn't get a clear picture about services on Android. Please provide some source code.
harish
  • 1,705
  • 5
  • 22
  • 36
102
votes
5 answers

How to update LiveData of a ViewModel from background service and Update UI

Recently I am exploring Android Architecture, that has been introduced recently by google. From the Documentation I have found this: public class MyViewModel extends ViewModel { private MutableLiveData> users; public…
46
votes
6 answers

How to check MIUI autostart permission programmatically?

I need to check programmatically if the auto start permission for my app in MIUI phone is on or off. Facebook and whatsapp have this permission already enabled by default , how can I do so?
Ekta Aggarwal
  • 524
  • 1
  • 5
  • 6
38
votes
7 answers

Android Background Service is restarting when application is killed

I am developing an application in which a background service is created to collect sensor data. I am starting the service from my activity: startService(new Intent(this, MyService.class)); I created the service so if the application is destroyed,…
duncanportelli
  • 3,021
  • 7
  • 35
  • 58
35
votes
1 answer

Android application as a service without activity

I am making a set of apps and I have pretty much the same background service for all of them. I'm trying to make an app that has only this Service. so I don't repeat it in all of them, but the thing is don't need any Activity. because there is no UI…
34
votes
3 answers

Get location in Ionic/Cordova app when in background

Is it possible to run a background service if I close my Ionic/Cordova app (both for iOS and Android) ? For the purpose I picked that pluging https://github.com/katzer/cordova-plugin-background-mode So far I have that…
radioaktiv
  • 2,357
  • 4
  • 25
  • 33
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
21
votes
1 answer

Android Silent Push

I am new to android and I'm playing around trying some features here and there. I wanted to know what is the way to use silent push - meaning get a push notification on the device without any alarm, notification or vibration - i.e. without the user…
20
votes
2 answers

Execute task every second using Work Manager API

Work Manager is a new API and I try to execute task every second, but it doesn't work. This is my worker class class TestingWorker : Worker(){ override fun doWork(): Result { Log.i("CheckWorker","Result here") return…
19
votes
1 answer

Voice Recognition as a background service

Is it possible to implement an activity as a service? My activity is a voice recognition activity. I want to have the activity running in the background of the app constantly checking for voice and when the user says a command it will recognize it…
IZI_Shadow_IZI
  • 1,851
  • 4
  • 30
  • 59
16
votes
4 answers

How to restart service after the app is killed from recent tasks

I have created a service to fetch current location of the device in periodic intervals. I want the service to run in the background even if the app is cleared from recently opened apps. Currently the service runs in background only until app is…
15
votes
3 answers

How to run BackgroundService on a timer in ASP.NET Core 2.1

I want to run a background job in ASP.NET Core 2.1. It has to run every 2 hours and it will need to access my DI Container because it will perform some cleanups in the database. It will need to be async and it should run independently of my ASP.NET…
15
votes
3 answers

Is there any equivalent of Services of Android in iOS?

I want to check the database in my app every 12 hrs for rows with date column having corresponding date. This is accomplished by writing service in android. But is there any equivalent of services in iOS so that my requirement can be accomplished?
viks
  • 384
  • 2
  • 5
  • 14
14
votes
4 answers

keeping background service alive after user exit app

I'm trying to create a service that will do background jobs for me even after the user closes the app from the running processes menu(by shifting process out of the screen). What I tried to do is create service in a different process by declaring it…
Nativ
  • 3,009
  • 6
  • 33
  • 61
1
2 3
46 47