Questions tagged [android-service]

A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use.

A Service is an application component representing either an application's desire to perform a longer-running operation while not interacting with the user or to supply functionality for other applications to use. Each service class must have a corresponding declaration in its package's AndroidManifest.xml. Services can be started with Context.startService() and Context.bindService().

Android Service Class Reference

Tutorials & Examples

6696 questions
2
votes
0 answers

Access to device homescreen from AlertDialog

I have added an AlertDialog to a Service. However, when this AlertDialog appears, my Home Screen appears in the background. When I press "Ok" on my AlertDialog, the notification disappears, however leaves me on my Home Screen of my application,…
2
votes
1 answer

Android Job Scheduler - calling a job on a recurring schedule until cancelled?

With the release of Oreo/Android 8.0, I'm wanting to replace my GPS foreground service with a scheduled job. I've looked at the Xamarin Example for Job Scheduler, and honestly I find it quite confusing. Here is all I want to do: User taps a…
user1819747
2
votes
1 answer

Binding Android service

A common approach for checking if you have bounded to a service in Android is keeping a boolean parameter such as mBound in your binding steps as described in Android developers guide. I noticed a problem in this Android reference tutorial and I…
Afshin
  • 8,839
  • 1
  • 18
  • 53
2
votes
1 answer

Android: Is Possible to Passing parameter from CursorAdapter to Service

I just want to pass a variable that I get from cursor to Service. But always get a NullPointerException. This is my adapter, which I use to show data into listView. public class DetailCategoryCursorAdapter extends CursorAdapter{ private Services…
Ugy Astro
  • 357
  • 3
  • 6
  • 16
2
votes
2 answers

SecurityException: Not allowed to start Service

In our app we have a Service defined in this way When Activity's onCreate() is called, app starts this Service. And everything is fine, until it is moved to background for a…
Ufkoku
  • 2,384
  • 20
  • 44
2
votes
1 answer

SyncService for synchronizing data between android and server not starting

I am currently trying to synchronize some data with a server using a background service. Using the following sites as…
2
votes
1 answer

Switching from Android Camera API to Camera2 API

I'm using a tablet running Android 5.1. I have implemented a service using the Camera API for recording the front cam in the background. The code is shown below. Now I would like to change it to Camera2 API. In addition I would like to manually set…
machinery
  • 5,972
  • 12
  • 67
  • 118
2
votes
4 answers

android: scheduling job every hour forever

I have a web service on my server that needs to be pinged every hour. For this, I am using an Android app to ping it every hour. I have tried using Alarm manager but it stops working after few hours and if I swipe exit it. I have tried using service…
2
votes
2 answers

Notification started from service doesn't open the app on click

Good Morning, I've made an application that implements GpS Location. I have a service that save my location on LocationChanged event. To avoid that Android close my app I start a notification and all works well. But now, I want that when I click on…
2
votes
0 answers

Why onTaskRemoved method not called while clear "Recent Apps" in mi device

When I am using service in my Android application onTaskRemoved() Method doesn't call in some devices like redmi mi(in Redmi device,I clear the app by holding the home button and clear the recent apps, onTaskRemoved() method doesn't called but it…
2
votes
1 answer

Notification Listener Service not started when running in debug mode

I am building an app using the NotificationListenerService. But always when I run the app in debug mode the Service is not started. I reduced my code to the following: My Acticity: class MainActivity : AppCompatActivity() { override fun…
unlimited101
  • 3,653
  • 4
  • 22
  • 41
2
votes
1 answer

onHandleWork never receives intent from pending intent Geofencing

I am working on a Geofencing application. The JobIntentService subclass that handles the GeofenceTransitions never receives the intent. I am receiving location updates at one minute interval then creating a new geofence list then adding the…
2
votes
1 answer

How to open an activity at a pre-determined time from boot up

I need my app to open at a scheduled time. I've searched for the best way of doing this and have got quite confused. I'm currently using BroadcastReceiver to respond to onBoot. That works fine but which way is best to go next? Should I set up an…
2
votes
2 answers

Have latitude and longitude in a service return 0.0

I am a beginner in Android application development. I will get latitude and longitude from GPSTracker.class every 5 minutes for send to SQLite DB in next step but when I call GPSTracker.class It's return latitude = 0.0 and longitude = 0.0 too help…
sirinan jirinsa
  • 161
  • 1
  • 1
  • 10
2
votes
2 answers

Counting time in background service

I've made a running app and for that, I've made a Service class to update user location (removed unimportant code): public class LocationService extends Service implements GoogleApiClient.ConnectionCallbacks,…
Makalele
  • 7,431
  • 5
  • 54
  • 81