src/com/btwiz/test/Tester.java
public static void listenForConnections(final Context context, SecureMode secureMode) {		
		try {
			if (!BTWiz.isEnabled(context)) {
				// TODO call startActivity with BTWiz.enableBTIntent() allowing user to enable BT
				return;
			}
		} catch (DeviceNotSupportBluetooth e) {
			// TODO disable BT functionality in your app
			return;
		}

		IAcceptListener acceptListener = new IAcceptListener() {			
			@Override
			public void onNewConnectionAccepted(BTSocket newConnection) {
				// log
				BluetoothDevice device = newConnection.getRemoteDevice(); 
				String name = device.getName();
				String addr = device.getAddress();
				int major = device.getBluetoothClass().getMajorDeviceClass();
				String majorStr = Utils.majorToString(major);
				Log.d("Tester", "New connection: " + name + ", " + addr + ", " + majorStr);
				
				// TODO work with new connection e.g. using
				// async IO methods: readAsync() & writeAsync()
				// or synchronous read() & write()
			} 
			@Override
			public void onError(Exception e, String where) {
				// TODO handle error
				Log.e("Tester", "Connection error " + e + " at " + where);
			}
		};
		
		BTWiz.listenForConnectionsAsync("MyServerName", acceptListener, secureMode);
		
		Log.d("Tester", "Async listener activated"); 

		// Note: to terminate listen session call BTWiz.stopListening()
		
		// TODO call BTWiz.cleanup() at end of BT processing 
	}
/**
	 * Test becoming a BT server and accept()ing new connections
	 * If secureMode equals SECURE: listenUsingRfcommWithServiceRecord will be internally activated
	 * Else: listenUsingInsecureRfcommWithServiceRecord
	 */
Test becoming a BT server and accept()ing new connections
If secureMode equals SECURE: listenUsingRfcommWithServiceRecord will be internally activated
Else: listenUsingInsecureRfcommWithServiceRecord
Test becoming a BT server and accept () ing new connections If secureMode equals SECURE : listenUsingRfcommWithServiceRecord will be internally activated Else : listenUsingInsecureRfcommWithServiceRecord
public static void listenForConnections(final Context context, SecureMode secureMode) {		
		try {
			if (!BTWiz.isEnabled(context)) {
				return;
			}
		} catch (DeviceNotSupportBluetooth e) {
			return;
		}
		IAcceptListener acceptListener = new IAcceptListener() {			
			@Override
			public void onNewConnectionAccepted(BTSocket newConnection) {
				BluetoothDevice device = newConnection.getRemoteDevice(); 
				String name = device.getName();
				String addr = device.getAddress();
				int major = device.getBluetoothClass().getMajorDeviceClass();
				String majorStr = Utils.majorToString(major);
				Log.d("Tester", "New connection: " + name + ", " + addr + ", " + majorStr);
			} 
			@Override
			public void onError(Exception e, String where) {
				Log.e("Tester", "Connection error " + e + " at " + where);
			}
		};
		BTWiz.listenForConnectionsAsync("MyServerName", acceptListener, secureMode);
		Log.d("Tester", "Async listener activated"); 
	}
public static void listenForConnections ( final Context context , SecureMode secureMode ) { try { if ( ! BTWiz . isEnabled ( context ) ) { return ; } } catch ( DeviceNotSupportBluetooth e ) { return ; } IAcceptListener acceptListener = new IAcceptListener ( ) { @ Override public void onNewConnectionAccepted ( BTSocket newConnection ) { BluetoothDevice device = newConnection . getRemoteDevice ( ) ; String name = device . getName ( ) ; String addr = device . getAddress ( ) ; int major = device . getBluetoothClass ( ) . getMajorDeviceClass ( ) ; String majorStr = Utils . majorToString ( major ) ; Log . d ( "Tester" , "New connection: " + name + ", " + addr + ", " + majorStr ) ; } @ Override public void onError ( Exception e , String where ) { Log . e ( "Tester" , "Connection error " + e + " at " + where ) ; } } ; BTWiz . listenForConnectionsAsync ( "MyServerName" , acceptListener , secureMode ) ; Log . d ( "Tester" , "Async listener activated" ) ; }
Test becoming a BT server and accept()ing new connections
 If secureMode equals SECURE: listenUsingRfcommWithServiceRecord will be internally activated
 Else: listenUsingInsecureRfcommWithServiceRecord
Test becoming a BT server and accept () ing new connections If secureMode equals SECURE : listenUsingRfcommWithServiceRecord will be internally activated Else : listenUsingInsecureRfcommWithServiceRecord
// TODO call startActivity with BTWiz.enableBTIntent() allowing user to enable BT // TODO disable BT functionality in your app // log // TODO work with new connection e.g. using // async IO methods: readAsync() & writeAsync() // or synchronous read() & write() // TODO handle error // Note: to terminate listen session call BTWiz.stopListening() // TODO call BTWiz.cleanup() at end of BT processing 