I'm making an app that will collect data using a sensor, only when the device is on. This program will mainly run from the notification bar. Most of the posts about using sensors in the background seem to suggest using Service but I've read that IntentServices are the way to go if handling a long task. So I was wondering which one would be best to use?
In Android when collecting data using a sensor should I use IntentService or Service?
416 views Asked by user1840378 At
1
There are 1 answers
Related Questions in ANDROID
- Creating global Class holder
- Flutter + Dart: Editing name of a tab shows up a black screen
- android-pdf-viewer Received status code 401 from server: Unauthorized
- Sdk 34 WRITE_EXTERNAL_STORAGE not working
- ussd reader in Recket Native module
- Incorrect display of LinearGradientBrush in IOS
- The Binary Version Of its metadata is 1.8.0, expected Version is 1.6.0 build error
- I can't make TextInput to auto expand properly in Android
- Creating multiple instances of a class with different initializing values in Flutter
- How to create a lottie animation
- making android analyze with coverity sast tool
- Flutter plugin development android src not opening after opening example
- I initialize my ViewModel in the Activity with several fragments as tabs, but the fragments(tabs) return null for the updated livedata
- Node.js Server + Socket.IO + Android Mobile Applicatoin XHR Polling Error...?
- How I can use the shared preferences class?
Related Questions in ANDROID-SERVICE
- My Foreground service is crashing on Android 14
- How to launch android activity in background, or minimized, when screen locked in Android 14 and start the activity with broadcast intent
- The slider does not move after pausing the player MediaSession Android studio
- Android service and thread in singleton are the equivalent?
- How to ensure that my foreground service will be running as long as possible?
- onServiceConnected not called but context#bindService return true
- How can I make an app reopen when closed on an Android device?
- stopservice does not work after ondestroy
- How to run a service in background on Android 10? Rooted device
- How to disable TileService for Android 34+ but keep for previous versions?
- Is okay to collect state from Service in ViewModel for my android app?
- What is the differernce between foreground and background service in Android in terms of code?
- Users crashing because of Service.startForeground() not allowed due to mAllowStartForeground false only on Anddroid 14
- .NET MAUI Android - Unable to create service: class not found exception
- Delphi Android service was stopped after closing the android application
Related Questions in ANDROID-SENSORS
- The BH1750 fails to be configured
- Assigning sensor information to image coordinates
- Device pose android emulator rotation values to App
- proximity sensor permission in android app
- I cannot programatically access files on my rooted Galaxy s10+
- Workaround for TYPE_STEP_COUNTER onSensorChanged not triggered in background
- LibGDX camera rotation does not work on Android
- How do I use coroutines in my Kotlin code to read in phone sensor data one by one?
- There is a way to know if other application is using a sensor [Android]
- How to add fixed delay in sensors readings in kotlin?
- Samsung Galaxy Note 9: sensors: wrote an app that reads all sensors, asks for BODY_SENSORS permissions, displays heartrate, how to display SpO2?
- Custom Rotation observer which works like ActivityInfo.SCREEN_ORIENTATION_SENSOR (android:screenOrientation="sensor") in Activities
- How to measure radiation(Non Ionizing) [Android SDK] for a Radiation measuring application
- can someone help me with accessing RGB values on my smart-phone light sensor via Android studio?
- Android Auto Car Sensors: unavailable when testing on a real car
Related Questions in ANDROID-INTENTSERVICE
- I'm trying to open a particular whatsapp group through my app using intents, but unfortunately the app crashes everytime
- How do I get the Alarm Class to Trigger Properly Everytime?
- if i create an android application which is using custom service written by me , will it works same with the built in service
- Xamarin Android AndroidX.Core.Content.FileProvider.GetUriForFile NullReferenceException
- startActivityForResult usage for 3 activity Android
- Get action name of intent filter located in service tags in Android
- onHandleIntent not being called in Unity app Android plugin, how to fix?
- Android intent service is finished after start
- Regarding new version of andriodx in andriod studio
- (Pending)intent opens SMS Application if File doesn't exist
- Not allowed to start service Intent without permission android.permission.BIND_JOB_SERVICE
- Which service should I implement if I want it to do each 5 seconds one same work?
- I want to use Service for Phone number
- I am new in developing android application, i just want to know how this method if working
- How does the value of an object get passed from a Receiver to MainActivity(or the calling class)?
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
It sounds more like you would need a
Service, as you will have a long-running operation (monitoring the sensors) which will pause (but not destroy) during some periods when the monitoring will not be required.Using a
Servicewill also allow your app's activities to bind to it, and show something like live updates. What you however need to be aware of is that if you would like to do something periodic in yourServicethen you will need to handle the scheduling and threading (if necessary, depending on the amount of processing required) yourself.You could for example use an
IntentServiceif you wanted to send the collected data to a remote server, as this will nicely kick off a worker thread for you to perform the (slow) network request on.