10-13-2009 06:48 AM
As far as I know there is no API to do that.
Thank you for your response. But please have a look at the following thread mentioned, in which the guy is claiming that he has done it using USBPortListene. I don't know how he has done it.
10-13-2009 07:11 AM
I think he listens for requested usb-connection via Listener.
Gets the channel, opens it via net.rim.device.api.system.USBPort class and immediately closes it via close() method of the same class.
10-13-2009 07:12 AM - edited 10-13-2009 07:14 AM
As there is no official API to disable USB connections you should experiment whether you can use some sort of unoffical way to terminate the USB connection. One thing you can try is to register a USBPortListener with the Application instance. Make sure that USBPortListener#getChannel returns -1 (get events for all channels). The big question now is whether you can force the USB connection to not connect. You can try to throw some RuntimeException in USBPortListener#connectionRequested and hope that it cancels the USB connection.
Note: everything I have written above is just an idea and I have not tested any code
Post note: tbilisoft's suggestion is much better
10-13-2009 07:47 AM
I am also doing the same thing.
If we implement USBPortlistner, then we need to override all the methods, then what should i write in getChannel() method?
Tiblisoft, Can you please explain in more detail what you suggested.
I tried what you suggest, but device is getting connected through USB.
10-13-2009 08:47 AM
I have tried to in the both way, that is return -1 and 0 from the getChannel() method, but no luck yet. I am still trying to find some way. If anyone can find anything regarding this please post it here.