On Thursday, 16 May 2013 11:18:35 UTC+1, David wrote:
>
> Hi,
>
>   I write a service with UEventObserver to listen some event from USB 
> device plug/unplug. 
>   But it can not catch event if I plug the device when booting.
>
>   Is there anyway that Java service can catch such event or I need to read 
> device state manually?
>   
>   
>

Hi 
I think you need to read the state manually, I don't do much in user-space 
but I think i'm correct in saying that the earliest notification a java 
service can recieved is RECEIVE_BOOT_COMPLETED. That being the case , any 
uevent messages from the kernel are long gone.

I wrote a native service a while ago to handle the same use case, in my 
instance it auto usb_modeswitched 3G Dongle into modem mode. Personally I'd 
go native everytime with stuff like this. I didn't see the point in having 
it in user space especially if it's meant to be always on and the user 
can't switch it off.

Here's the link to my github repo with said service, which you might find 
useful as it also sends all uevents to the logcat. Apologises for the code 
quality, I was just getting acquainted with c at the time  :D 

https://github.com/trevd/android_external_hotplugd 






-- 
-- 
unsubscribe: [email protected]
website: http://groups.google.com/group/android-porting

--- 
You received this message because you are subscribed to the Google Groups 
"android-porting" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to