Questions tagged [android-intentservice]

The IntentService class provides a straightforward structure for running an operation on a single background thread.

The IntentService class provides a straightforward structure for running an operation on a single background thread. This allows it to handle long-running operations without affecting your user interface's responsiveness. Also, an IntentService isn't affected by most user interface lifecycle events, so it continues to run in circumstances that would shut down an AsyncTask

An IntentService has a few limitations:

  • It can't interact directly with your user interface. To put its results in the UI, you have to send them to an Activity.
  • Work requests run sequentially. If an operation is running in an IntentService, and you send it another request, the request waits until the first operation is finished.
  • An operation running on an IntentService can't be interrupted.

However, in most cases an IntentService is the preferred way to simple background operations.

461 questions
2
votes
0 answers

I want to create an unstopable service in android?

I want to create a service that run every time in background I create one with different answer available on stack over flow but it is stopped by Power savor mode and battery savor mode in OPPO, Huawei devices. I tried alarm manager job scheduler…
2
votes
1 answer

Running a new thread from IntentService

Suppose I want my app to sync data from an online database to the local database, I understand Services are the components to look for. If I start a normal service, I understand that it starts in the main thread and any time-consuming task I run…
2
votes
0 answers

Notification not being created when Boot receiver calls a service

I have a receiver which gets triggered on Boot completion public class StartupReceiver extends BroadcastReceiver { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction() != null &&…
Sparker0i
  • 1,787
  • 4
  • 35
  • 60
2
votes
0 answers

IntentService crashes systemUI

I have an IntentService which is supposed to send thousands of Volley requests to my server. It works fine and is very fast. I create my requests based on a Cursor I get from a ContentProvider (getContentResolver()). I do however want to avoid…
geecko
  • 660
  • 1
  • 9
  • 22
2
votes
1 answer

Run Android Notifications when App is closed without GCM/Firebase

I am working on an App where I want to show Push Notifications. Please note that since it is my client's requirement NOT to use any third party services, so using GCM/Firebase is out of question. I am successfully able to show the notification from…
2
votes
3 answers

Android activity recognition issue

I am developing android native applications. My requirement is to get the current activity of the device like running,in_vehicle,still and so on. I used ActivityRecognitionAPI and set the pendingintent to receive the activity changes through…
2
votes
1 answer

Notification Android : Don't show notification when app is open?

I'm working on a project and I use Intent Service with wakefulBroadcastReceiver to schedule alarm and send notification. There are no problems this far. But I want when I open my app, it don't displaying notification again. Please any idea for this…
Finn D
  • 83
  • 1
  • 7
2
votes
0 answers

BroadcastReceiver is not receiving

I am new to the Android API and I am trying to implement a scheduled process that reports back to the app. So, I have the following code in my MainActivity: public class MainActivity extends AppCompatActivity { private AlarmManager almgr; …
Mohammed
  • 313
  • 2
  • 9
2
votes
1 answer

Android-how to implement TCP-ip client inside intentservice

i made a simple TCP-client and it's work fine when i use simple activity and button to send the message now i implement geofence application using same google geofence example here public class GeofenceTransitionsIntentService extends…
2
votes
0 answers

Cannot read data from DATA USAGE screen of device on button click

I am opening DATA USAGE screen on button click from my application, using the following Intent:- Intent intent = new Intent(); intent.setComponent(new…
2
votes
2 answers

How to auto refresh data displayed in my Android Activity every second

I need to auto refresh data displayed in my Activity every second, I've used runnable, timer etc. These works perfectly but after a few seconds the UI is slow and sometimes not responsive. I've read about IntentService but I don't think it's a good…
2
votes
2 answers

Save data in SharedPreferences when application is not running

I am using SharedPreferences to store my data. When my application is running data is been saved to SharedPreferences successfully but when i close my application and try to save data in it via Intent Service nothing happened . no data saved to it…
2
votes
3 answers

How to get device location every 5 minutes using background service in Android?

I want to fetch user location every 5 minutes and display as Toast. Which is the best way to do this? Service or IntentService? I want to start and stop the service on button click. How to do that?
Jas
  • 3,207
  • 2
  • 15
  • 45
2
votes
0 answers

How to periodicaly record screen from a background service using Android API MediaProjection?

Hello I'm building a weak AI (a bot) app on android but I'm fairly new to this. Context: The app is/will be composed of an UI to start/stop the bot and modify his settings, screen caputure service taking screenshot at fixed intervals (let's say…
2
votes
0 answers

Android Wear runnable for vibration works only in debug or with an active screen

i'm facing a big issue with android wearable development. I've got a Runnable task that runs with an Handler every 100mS (it's purpose is to behave just like a chronograph) on my phisical wearable device (that's a Motorola 360). When the Runnable…