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?
412 Views Asked by user1840378 At
1
There are 1 best solutions below
Related Questions in ANDROID
- Delay in loading Html Page(WebView) from assets folder in real android device
- MPAndroidChart method setWordWrapEnabled() not found
- Designing a 'new post' android activity
- Android :EditText inside ListView always update first item in the listview
- Android: Transferring Data via ContentIntent
- Wrong xml being inflated android
- AsyncTask Class
- Unable to receive extras in Android Intent
- Website zoomed out on Android default browser
- Square FloatingActionButton with Android Design Library
- Google Maps API Re-size
- Push toolbar content below statusbar
- Android FragmentPagerAdapter Circular listview
- Layout not shifting up when keyboard is open
- auDIO_OUTPUT_FLAG_FAST denied by client can't connect to localhost
Related Questions in ANDROID-SERVICE
- How to know when the services has ended
- Service stop doing its job after removing app from recent apps list
- android check location services enabled if using GoogleApiClient
- My service seems to restart when I close my app
- Broadcast not being received Android
- How to use alertDialog in background service
- How to send data from IntentService to Non-Activity class
- android -Can't create handler inside thread that has not called Looper.prepare()
- Alarm receive don't work
- Independent time tracking in android app: service or asynctask?
- AsyncTask is not running when called with execute
- Starting Activity With Intent Flags Stops Service After It Starts
- Android Service vs Simple class with thread for network access
- Android is killing my service?
- Update UI with background service
Related Questions in ANDROID-SENSORS
- Leveraging Sensor batching
- Instabug shake event not working
- onSensorChanged() not fired on Android (nVidia Shield Tablet)
- Android get quaternion data
- Block emulators in android application
- Tesla value of the magnetic field drops in the vehicle about 20 microtesla
- Sensor.TYPE_STEP_DETECTOR not found on android Lollipop
- How to know if Android device is Flat on table
- In Android when collecting data using a sensor should I use IntentService or Service?
- Android: How to get Google Fit data from Wearable device?
- Technique to measure distance from android app (between 0-60 mts)
- Wikitude: Redirecting Orientation Angles
- Android camera affects sensors (Accelerometer & Magnetic Field) while phone faces user
- How to get sensor data sequentially?
- how to get time if some condition met like gyroscope reading
Related Questions in ANDROID-INTENTSERVICE
- Socket listener in IntentService
- Passing objects through intents in Android
- android 5.0.1 file upload not throwing exception when network is lost
- In Android when collecting data using a sensor should I use IntentService or Service?
- How to check if App.onCreate() was called via a push notification or during app open by an user
- Android Service won't start from MainActivity
- Create Background service that Update Locations based on User Activity
- BroadcastReceiver is not receiving
- Sending Mail in Android Intent Without Pressing Send Button
- ActivityManager: Unable to start service Intent
- Image download failed when try to download by using IntentService in Android
- IntentService not called from BroadcastReceiver
- android app hangs starting a service
- Send Update to Repeating BroadcastReceiver
- Intent Service with network state change
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)
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?
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.