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 -~----------~----~----~----~------~----~------~--~---