android-service

Background Service getting killed in android

本秂侑毒 提交于 2019-11-27 10:30:02
We have developed an Android Application which involves a service in the background. To implement this background service we have used IntentService . We want the application to poll the server every 60 seconds . So in the IntentService , the server is polled in a while loop. At the end of the while loop we have used Thread.sleep(60000) so that the next iteration starts only after 60 seconds. But in the Logcat , I see that sometimes it takes the application more than 5 minutes to wake up (come out of that sleep and start the next iteration). It is never 1 minute as we want it to be. What is

Using a listener after an android application is closed

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 09:38:57
I've just been reading about adding a service to my application, and since 7/8 there are now service restrictions to improve phone performance. I've seen that the recommended approach is to use a job scheduler, but will that not just periodically start a new listener if I did that? Basically I update my database, and using a snapshot listener I want to update my user in real time. When the app is closed, I'd like to send a notification. My issues (if I'm correct) are that constantly making a new Firestore request will eat through my request allowance. Also, if its a job scheduler it won't

Permanently listen to Clipboard changes

风格不统一 提交于 2019-11-27 09:37:48
问题 I'm building an application that will launch a service capable to listen to clipboard changes. What i really want is to record (and write it in storage) every single change in the clipboard permanently, so when i launch my app i can read the stored files written by that service. This means, there's no need for direct communication between my app and the service and there's no need to use wakelocks to keep the device up (since the clipboard hardly changes while the device is asleep). I'm using

Is there any way to run service continuously in android?

∥☆過路亽.° 提交于 2019-11-27 09:10:36
There are few questions similar to this on StackOverFlow but none of the solutions are working for me Problem The problem is with only few devices like OnePlus and MI ,The service is getting killed as soon as the user swipes away app from recent app. I read that these OEM'S use some aggressive strategies to kill services . I just want to know is there any way to keep service running or start it as soon as it gets killed . What I want I need to run a service which will give location continuously (24/7) in background (This app is only for specific people so no worries about battery life) .

How to keep a service running in background even after user quits the app? [closed]

你。 提交于 2019-11-27 09:00:47
I am developing an app where I start a service if a particular feature (in my app) is enabled by user. I want to keep running this service even after user quits my app. How can I do this? plz help EGHDK Right from developer.android.com A service is a component that runs in the background to perform long-running operations or to perform work for remote processes. A service does not provide a user interface. For example, a service might play music in the background while the user is in a different application, or it might fetch data over the network without blocking user interaction with an

Samsung “App optimisation” feature kills background applications after 3 days

旧城冷巷雨未停 提交于 2019-11-27 08:49:23
We are currently developing an Android app that is a fitness-tracker application. It runs constantly in the background, and it works fine on most devices, but we've been having issues with the application dying completely on some Samsung devices. After some investigation, it seems like some Samsung devices has a completely custom "App Optimisation" feature ( http://forums.androidcentral.com/samsung-galaxy-s6/599408-app-optimisation-after-updating.html ), which is basically a (very) primitive version of the Doze feature that exists in later versions of Android which basically just murders apps

Create only one instance of Service (Android)

生来就可爱ヽ(ⅴ<●) 提交于 2019-11-27 08:34:27
How can I make sure that only one instance of Service is created? I have checked some functions with logging (WeatherService is the class who extends Service): Log.i(TAG, "Start Id:" + WeatherService.this.hashCode()); Log.i(TAG, "End Id:" + WeatherService.this.hashCode()); It gives different hash codes even when I am sure that the same function is running twice (downloading): 09-12 01:00:55.195: INFO/WeatherService(7222): Start Id:1137653208 09-12 01:00:57.235: INFO/WeatherService(7222): Start Id:1137654296 09-12 01:00:59.035: INFO/WeatherService(7222): Start Id:1138806536 09-12 01:01:39.085:

Passing information to a HostApduService from another Context

戏子无情 提交于 2019-11-27 07:58:58
问题 This has been asked before with no responses, so I will try to phrase the question a bit differently. What are the various ways to pass some data to an Android Service without being able to bind to it or start it myself? Here's the issue - I have a HostApduService that is started by the operating system on every NFC card transaction. It requires the permission android.permission.BIND_NFC_SERVICE , which is a system permission, so my application can't bind to it. I don't want to leave data at

Reasons that the passed Intent would be NULL in onStartCommand

泄露秘密 提交于 2019-11-27 07:43:35
Is there any other reason that the Intent that is passed to onStartCommand(Intent, int, int) would be NULL besides the system restarting the service via a flag such as START_STICKY ? Also, when the service is restarted by the system the Intent.getAction() method returns NULL... sometimes. Intent is not NULL just getAction() I asked here too but haven't received an answer just yet. UPDATE : After chatting with Mark Murphy, he suggested that I return START_REDELIVER_INTENT in the onStartCommand() callback in my service instead of START_STICKY so that the entire intent is sent following a restart

Schedule a TimerTask at specific time once per day in a service in android

*爱你&永不变心* 提交于 2019-11-27 07:33:49
问题 I have a TimerTask object timerTask . My code is running but when service gets started initially, my timer task runs instantly before the specified time i.e. 3:30 PM, though I want it to run on 3:30 PM once per day only. Calendar cal = Calendar.getInstance(); cal.set(Calendar.AM_PM, Calendar.PM); cal.set(Calendar.HOUR, 3); cal.set(Calendar.MINUTE, 30); cal.set(Calendar.SECOND, 0); Date date = cal.getTime(); timer.schedule(timerTask, date, 1000*60*60*24); // once per day 回答1: As other