Tejas wrote: > Now, my question is : Will using the timer class, have the same effect > as using the AlarmManager ? or will it consume more resources.
Generally speaking, your goal is to not have your code run and not have your code be in memory. The more your code runs, the more battery you consume. The more memory you take up, the more difficult it is for other applications to run. And, as Ms. Hackborn mentioned, your service will eventually be destroyed, anyway. The best way to do polling operations in Android is to use the AlarmManager and an IntentService. However, that does not work well with interfaces where you have to register listeners, such as SensorManager. Another way to do polling operations in Android is to use the AlarmManager and a regular service that does something like this: -- in onStart(), attaches itself to SensorManager and anything else listener-based -- as those listeners are called, collects data -- as soon as it gets data from all listeners and records it, the service calls stopSelf() So long as those listeners will do their work in a shorter time than your polling period, you should be fine. This keeps your code out of memory the vast majority of time. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://github.com/commonsguy http://commonsware.com/blog | http://twitter.com/commonsguy Android 2.2 Programming Books: http://commonsware.com/books -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en