Hi Dianne,
Thanks a lot for your help.

According to the reply from Yi Sun:
>>>>Look into the update() method in BatteryService.java. You may be able to
>>>>solve the issue by register for BATTERY_CHANGED. But, it only be sent
>>>>out when the battery status is changed. Not sure if it is good for you
>>>>or not.
I checked the source code of com.android.server.BatteryService#update
(), yes, the update method first call native_update(),
then check for the status, if some status field changed, then
sendIntent() will be invoked to broadcast.
My question is "does that mean I can not get the battery information
in real-time?", I mean if I launch the application at 00:00:00, then
return to home screen,
then relaunch it at 00:00:30, then maybe none of the status changed,
does that mean I can not get any status information?

Thanks.

On May 26, 3:16 pm, Dianne Hackborn <hack...@android.com> wrote:
> On Mon, May 25, 2009 at 8:12 PM, zhangxiyuan <zhangzho...@gmail.com> wrote:
> > And I have three other questions:
> > 1. Which apis will be included in the sdk public api? Is there any
> > description about it?
>
> The official public SDK is only the things described here:
>
> http://developer.android.com/reference/packages.html
>
> And yes, @hide is used to keep classes and methods out of the SDK.
>
> 2. I modified the com.android.settings.BatteryInfo activity to another
>
> > activity, delete all the api invocation to the non-public api,
> >   I can still get the battery information such as level, scale, ...
> >   so, I think what I really need to do is just impelement the
> > BroadcastReceiver, and registerReceiver in the onCreate or onResume
> > methods.
> >   Is that right?
>
> Yes, as I said, most of the information is sent as a sticky broadcast.
>
> > 3. I do not have a real android-based phone, so I just run the
> > application on the emulator, I got the following information all the
> > time:
> > Battery status: Charging (AC)
> > Battery level: 50
> > Battery scale: 100
> > Battery health: Good
> > Battery voltage: 0 mV
> > Battery temperature: 0.0°C
> > Battery technology: Li-ion
> > I wonder how can I get different information by changing some
> > configurations of the emulator?
>
> Sorry can't help with that.
>
> --
> Dianne Hackborn
> Android framework engineer
> hack...@android.com
>
> Note: please don't send private questions to me, as I don't have time to
> provide private support, and so won't reply to such e-mails.  All such
> questions should be posted on public forums, where I and others can see and
> answer them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"android-framework" group.
To post to this group, send email to android-framework@googlegroups.com
To unsubscribe from this group, send email to 
android-framework+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/android-framework?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to