views:

198

answers:

1

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:

  1. A Photo-taking application (Activity) that will gather all the extra data and put in the SQLite DB.
  2. 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).
  3. A receiver object that will run the service at boot, and optionally check if the service needs to be restarted.

My concerns are:

  1. Do I really need to monitor the service and care about anything bad that could kill it.
  2. 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)
  3. What else should I be careful about?

Any ideas/suggestions will be appreciated.

+2  A: 

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.

CommonsWare
Thank you, good to know.
ohnoes
This really brightened my rather dull morning! Thanks Mark :)
DroidIn.net
Actually for p.1 you don't need Activity to take a photo - that's built in. You need it to post-process the photo
DroidIn.net