Hi, Thanks for your reply. Well I want to write in C because I know only that.. I wrote a small program based on netlink to receive uevent and it works fine. But now I am a bit confused because I am getting all events and not the only one. How can I parse an uevent message? Is there any data structure for it?
If I want to do it in Java, then can you give me an example of it? Thanks/ Hvr On Jul 18, 4:57 pm, Durgadoss Ramanathan <[email protected]> wrote: > Hi, > > Android has a UEvent Listener in the Application Framework. > This receives the UEvent from the Kernel. > > For BatteryStatus: > You may want to look at > frameworks/base/services/java/com/android/server/BatteryService.java > Similarly, also at BatteryServer.cpp(corresponding JNI..) > > Basically the battery service gets info from the JNI and packs them into an > intent > and broadcasts it. Intent : Action_Battery_Changed > You can register to listen this intent and extract every little detail from > this :) > > BTW, Nothing stops you from writing a C program that can catch > the UEvents. You have to write a Netlink Socket receiver..in order to do > that. > > Just Curious, Why you want to do that in C ? > > [If you are Ok to that in Java, then its very simple & easy..] > > > > > > On Mon, Jul 18, 2011 at 4:45 PM, Hemant <[email protected]> wrote: > > I want to handle uevent in user-space mainly for battery status > > changed in my application. > > Can this be done using C program? > > Can this be done by calling a select() on one of the sysfs which > > indicates change in battery voltage? > > How Android polls uevents from kernel? > > > Br/ > > Hvr > > > -- > > You received this message because you are subscribed to the Google > > Groups "Android Developers" group. > > To post to this group, send email to [email protected] > > To unsubscribe from this group, send email to > > [email protected] > > For more options, visit this group at > >http://groups.google.com/group/android-developers?hl=en > > -- > Regards > Durgadoss- Hide quoted text - > > - Show quoted text - -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

