android-intentservice

Android: intentservice, how abort or skip a task in the handleintent queue

老子叫甜甜 提交于 2019-11-30 06:44:24
i have an activity ("ApplicationActivity") that call an intent service ("DownloadService") The intentService download files from internet in background, but i want to be able to abort a specific download......... So let's say that i put 5 files in queue: file 1,2,3,4,5 The intent service start downloading the number 1, then the second and so on.... 1) Is there a way to say to the intent service abort what you are doing at the moment in the method handle event (in this case downloading file 1) and start downloading the next one? 2)Is it possible to remove element from the queue, so for example

How to download multiple files concurrently using intentservice in Android?

亡梦爱人 提交于 2019-11-30 04:33:30
I want to create a service similar to this one, (reference from Here ), to download multiple files asynchronously in Android. public static class DownloadingService extends IntentService { public static String PROGRESS_UPDATE_ACTION = DownloadingService.class .getName() + ".newDownloadTask"; private ExecutorService mExec; private CompletionService<NoResultType> mEcs; private LocalBroadcastManager mBroadcastManager; private List<DownloadTask> mTasks; public DownloadingService() { super("DownloadingService"); mExec = Executors.newFixedThreadPool( 3 ); // The reason to use multiple thread is to

Android InstantiationException : No empty constructor

孤人 提交于 2019-11-29 12:45:01
I get an InstantiationException when I try to start an IntentService. I have looked at other threads here but the answers don't solve my problem. My service class does have a default constructor. Here's my service class. (It is defined in a file FindMeService.java and that's the only class in that file.) package com.findme.findme; import android.app.IntentService; import android.content.Intent; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; public class FindMeService extends IntentService { /*public static class Constants { }*/ public static final String

Service Automatic Called on Destroying Activity

女生的网名这么多〃 提交于 2019-11-29 03:41:51
I am stuck with the problem of Activity + Service in that I have following number of Activities and Services. Activities: LoginActivity => OrderListActivity => AddOrderActivity => ConfirmOrderActivity Services: ReceivingOrderService - Receiving New Data From Server SendingOrderService - Sending new Data to Server Above both Service Calling from another Separate Service on duration of some interval . CheckAutoSyncReceivingOrder - To call ReceivingOrderService (Interval 15Mins) CheckAutoSyncSendingOrder - To call SendingOrderService (Interval 3Mins) CheckAutoSyncReceivingOrder: public class

Set “allow” permission by default in “Asus auto start manager” from code

不想你离开。 提交于 2019-11-28 17:38:18
I have an application which needs to run in the background, so I'm using a WakeFullService for that. But in Asus Zenfone it's not working because Auto start manager does not allow the app to run. My expectation is: To set "allow permission" in auto start manager during our app install or at the time of app opening. Is there any API available from ASUS Auto Start Manager which can help me check the permission status of my app so that I can notify the user via normal text alert to turn on the permission. Someone did it for Huawei: "Protected Apps" setting on Huawei phones, and how to handle it

Android InstantiationException : No empty constructor

扶醉桌前 提交于 2019-11-28 06:07:08
问题 I get an InstantiationException when I try to start an IntentService. I have looked at other threads here but the answers don't solve my problem. My service class does have a default constructor. Here's my service class. (It is defined in a file FindMeService.java and that's the only class in that file.) package com.findme.findme; import android.app.IntentService; import android.content.Intent; import android.os.Bundle; import android.support.v4.content.LocalBroadcastManager; public class

Does FirebaseMessagingService run in the background by default?

懵懂的女人 提交于 2019-11-28 04:07:47
问题 Does the FirebaseMessagingService run in the background similar to how an IntentService operates? I see that FirebaseMessagingService extents Service which does not run in the background, but I'd like to be sure whether or not I should be doing any work inside the FirebaseMessagingService asynchronously or synchronously. Thank you 回答1: FirebaseMessagingService 's method onMessageReceived(RemoteMessage message) is called "in the background" (not on the UI/Main thread). If you try do

IntentService + startForeground vs JobIntentService

偶尔善良 提交于 2019-11-27 22:37:41
问题 Since Android Oreo background execution limits, the docs recommend to refactor IntentService s to JobIntentService . https://developer.android.com/about/versions/oreo/background JobIntentService runs immediately as an IntentService below Oreo, but schedules a Job on Oreo+ https://developer.android.com/reference/android/support/v4/app/JobIntentService In what cases would it make sense to run a normal IntentService as a foreground Service with a persistent notification, and when is a

Asking an IntentService for information about its queue

♀尐吖头ヾ 提交于 2019-11-27 20:49:57
I have an IntentService that queues up web service calls that need to be made to my web server. So each Intent is a web service call to be made. I'd like to set something up where my application can ask this IntentService if it has any Intents containing a particular piece of data (IE: "Are you already waiting to ask the cloud for x data? Or do I need to tell you to do it?"). Are there any suggestions on how I might extend IntentService to do this? Can the Intent queue of an IntentService be traversed? Or would I need to take the IntentService code and alter it? The only other idea I have is

Set “allow” permission by default in “Asus auto start manager” from code

你离开我真会死。 提交于 2019-11-27 10:52:23
问题 I have an application which needs to run in the background, so I'm using a WakeFullService for that. But in Asus Zenfone it's not working because Auto start manager does not allow the app to run. My expectation is: To set "allow permission" in auto start manager during our app install or at the time of app opening. Is there any API available from ASUS Auto Start Manager which can help me check the permission status of my app so that I can notify the user via normal text alert to turn on the