Sunday, February 12, 2012

Re: [android-developers] Android Long Running Service and database

On Thu, Feb 9, 2012 at 11:26 AM, t4ure4n <t4urean@googlemail.com> wrote:
> I am working on a program which consists of two parts
>
> Service component will read various system features (CPU usage, RAM
> usage, Number of Running Tasks, Messages Sent, Calls Made etc) every
> pre determined time interval lets say 15 minutes. And save these
> readings/data in a database.
>
> Activity component will read the data from SQL database file and
> process the information.
>
> My Questions are
>
>  1.  What kind of service do I have to create that will stay alive
> forever until stopped by the activity it should also automatically
> restart after system reboot?

You don't. For work every 15 minutes, you use AlarmManager and an IntentService.

>   2.  Has anyone got an example of service writing data to database?

That would be no different than writing data to a database from
anywhere else in an Android app.

>   3.  Can I invoke the parent activity from the service?

Services do not have a parent activity.

--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy

_The Busy Coder's Guide to Android Development_ Version 3.7 Available!

--
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+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment