Yes, services are designed exactly for that: asynchronous tasks that can take a long time and need to keep running even when the activity is closed.
Thank you for your response. Do you know how I would go about modifying my code to implement a Service? – Matt May 31 at 19:02 This explains everything pretty clearly.
– trutheality May 31 at 19:05 Thank you - I'll read the link more and likely accept your answer in time. – Matt May 31 at 19:10.
If you are trying to understand Service and IntentService, I would recommend you to take a look at this post and related posts. It compares various task execution mechanisms in Android and provides a rough guideline on when to use what.
Thank you for your answer - the comparison table is especially useful to me. I noticed that you also mention communication between Services/IntentServices and the main Activity. This is something that I will need to implement as well.
– Matt May 31 at 19:29.
1) After a specified delay, the application requests data from a Bluetooth device. 2) The application saves and analyzes the data. 3) IF the analysis results are abnormal, the application sets off an alarm and returns to step 1) with a shortened delay.
ELSE the application returns to step 1) as normal. I currently have an implementation working that utilizes a Timer and TimerTasks to analyze some data in a . Txt file repeatedly after various delays.
Later on in the application's development the data will be received from a Bluetooth device (the Android emulator doesn't support Bluetooth). I can't have the main UI thread busy handling this stuff - I need some form of asynchronous (multi-threaded) approach (ie. I also need this analysis process to continue even if the user switches to another application.
Do I need to use a Service/IntentService to ensure this Bluetooth reception & analysis procedure remains active? As a beginner Android developer, I would appreciate any advice on the subject. I am currently trying to understand Services and IntentServices.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.