Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Contributor
josepi09
Posts: 5
Registered: ‎04-13-2010
My Device: BlackBerry 8320
My Carrier: Att

Using IOPortListenner help me please =D

I want to avoid USB connection, so I thought using a USBPortListenner, everything its ok from now, but what function, should I use to close the connection, so it could act like avoiding usb.

 

This is the code I used for the listenner

 

import net.rim.device.api.system.IOPortListener;
import net.rim.device.api.system.USBPort;
import net.rim.device.api.system.IOPort;
import net.rim.device.api.system.*;


public final class TestUSB extends Application {  
	
	public static void main(String[] args) {     
		TestUSB app = new TestUSB();       
		app.enterEventDispatcher();   
		}   // End main function
	public TestUSB() {     
		addIOPortListener(new USBListenner());
                  }   
}

public interface USBPortListener extends IOPortListener {
void connectionRequested();
}
public class USBListenner implements USBPortListener {

	public void connectionRequested() {
		// Here should be the method to close connection
		IOPort port = new IOPort() ;
		port.close();
	}


}

 Can anyone help me out to avoid USB connection?

Please use plain text.