Android app components - a word of advice needed
I am a complete newbie to Android development;
Basically, I am about to write an application, that will let the user to take photo, which (with a bunch of extra data) will be submitted to the remote webservice.
So I'm guessing I will need:
- A Photo-taking application (Activity) that will gather all the extra data and put in the SQLite DB.
- A background service looking up the DB in time intervals and sending the data over the Internet, optionally making web requests with current GPS location (I'm trying to keep in mind, that sometimes network would not be accessible).
- A rec开发者_JS百科eiver object that will run the service at boot, and optionally check if the service needs to be restarted.
My concerns are:
- Do I really need to monitor the service and care about anything bad that could kill it.
- Will the battery last for at least 12 hours with a non-stop running service, making some networking/GPS actions in, let's say, 30-minute intervals. (G1/Dream)
- What else should I be careful about?
Any ideas/suggestions will be appreciated.
a word of advice needed
Rutabaga.
Oh, wait. You're probably looking for something related to Android. OK, carry on.
A receiver object that will run the service at boot, and optionally check if the service needs to be restarted.
Yuck. Use AlarmManager
and have your service behave more like a cron job/Windows scheduled task.
Do I really need to monitor the service and care about anything bad that could kill it.
Not if you use AlarmManager
and have your service behave more like a cron job.
Will the battery last for at least 12 hours with a non-stop running service, making some networking/GPS actions in, let's say, 30-minute intervals. (G1/Dream)
If you use AlarmManager
and have your service behave more like a cron job, a 30-minute interval should be OK. Just make sure you shut down the GPS radio when you are done with it. Note that using the GPS radio from a cron job sort of task is a bit tricky, since it takes a while to get its first fix. You will also want to take a look at using PowerManager.WakeLock
to keep the device awake until your work is completed.
What else should I be careful about?
Mynd you, moose bites kan be pretti nasti.
Beyond that and what I wrote above, you should be in OK shape. Note that what you are diving into is not exactly "newbie" material.
精彩评论