And I have three other questions:
1. Which apis will be included in the sdk public api? Is there any
description about it?
    For example, in the Android Open Source Project, there are many
classes in android.os package,
    the android.os.BatteryManager is released in the sdk, but
android.os.BatteryStats is not.
    In the javadoc of android.os.BatteryStats, there is a @hide
annotation, is that the trick?
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?
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?

Thanks.
Bother you so much.

On May 26, 9:44 am, zhangxiyuan <zhangzho...@gmail.com> wrote:
> Thanks so much for your reply.
> But how could I access the battery status that the
> com.android.server.BatteryService provided?
> If I want to collect that information, could you provide any hints of
> implementing that function?
>
> Thanks you.
>
> On May 26, 3:00 am, Dianne Hackborn <hack...@android.com> wrote:
>
> > There is no public API.  You can not use APIs that are not in the public API
> > in normal applications.  I am pretty sure most of the battery status
> > information is provided through sticky broadcasts.
>
> > On Mon, May 25, 2009 at 4:54 AM, zhangxiyuan <zhangzho...@gmail.com> wrote:
>
> > > Hi,
>
> > > I am sorry that I do not know whether this topic should appear here.
>
> > > I checked out the whole android open source project, and found the
> > > source code under /frameworks/base/services/java/BatteryService.java
> > > as well as the other service classes such as AlarmManagerService,
> > > WindowManagerService,...
> > > While in the android.content.Context#getSystemService(String name),
> > > the available names do not contains BATTERY_SERVICE.
> > > I want to know the reason. anybody knows that?
> > > I wonder if I want to know the information of the current battery
> > > status, such as scale, level, status, health,... which are defined
> > > in /
> > > frameworks/base/services/java/BatteryService.java, how should I
> > > collect these information?
>
> > > And I noticed that in the android application Settings, there is an
> > > BatteryInfo activity, which can collect these information, while the
> > > activity invokes a class named android.os.ServiceManager, while in the
> > > sdk 1.5r1, there is no such class. I pulled all the related class out
> > > to my workspace, and made it compiled without error, and ran the
> > > application, it can display the right information(I just use the
> > > emulator.).
> > > I wonder if I can just do it this way, I mean if I am developing a
> > > commercial application, is it ok?
>
> > > Thanks in advance, I am so appreciated for you anwser or just hints.
>
> > --
> > 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