Nick Owens wrote: > So, the AlarmManager is always available, while the phone is on of course, > to kickstart a task. I assume I would need to: > > 1.) Register my boot-receiver.
Yes. > 2.) In the boot receiver, I would instantiate the AlarmManager and tell it > how often to run the task. Yes. You might also need to do this on first run of your app after it is installed, depending on your deployment and expected usage model. > 3.) The task takes about .5 - 3 seconds, depending on time of day and > network traffic, so I assume I don't need to even hold a wakelock, right? > If kicked on, the phone would give me that much time (max 5 seconds) to > complete right, even if it was asleep when it kicked the task on? Well, that assumes great connectivity, which is far from a given with phones. Personally, I'd use the WakefulIntentService pattern for maximum cleanliness, but if you'd rather try to do the network I/O straight from the BroadcastReceiver, it's a free country and all... > I only need to run the task every 2 - 3 minutes, so if the AlarmManager can > do that 24 hours/day, awesome! Bear in mind, as demonstrated in the video, that you're going to use up maybe 75% of the battery life this way. > BTW, users of this app are not like your regular app. They already are > paying thousands for the app, so they won't beat down my door if the battery > dies checking to tell them if there is a security breach in a monitored > warehouse. No, but they will most certainly beat down your door if the battery dies while checking to tell them nothing. Where "beat down your door" means "stop subscribing to your service". Please consider making the polling period configurable. > W/ the iPhone, it's obviously not a problem b/c of the APNS service. If "it" is battery life, unless Apple has something magic going on with AT&T and other carriers, or have rewritten the laws of physics, APNS isn't great for battery life either. > I'm > only going this way b/c as I understand it, there is no way to address/send > a message to a user device (other than SMS) in real-time. There's no way out of the box, yes. -- Mark Murphy (a Commons Guy) http://commonsware.com | http://twitter.com/commonsguy Android Training...At Your Office: http://commonsware.com/training -- 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