1 RockyJagtiani TechnicalHead Suven Consultants Introduction Introduction This application allows twoAndroid devices to carry out two-waytext This application allows two Android devices to carry out two-way text chat over Bluetooth. It demonstrates all the fundamental Bluetooth API capabilities such as: API capabilities, such as: Scanning for other Bluetooth devices Q i th l l Bl t th d t f i d Bl t th d i Querying the local Bluetooth adapter for paired Bluetooth devices Establishing RFCOMM channels/sockets Connecting to a remote device Transferring data over Bluetooth 2 RockyJagtiani TechnicalHead Suven Consultants Process of Bluetooth Chat Application This application first checks whether the Bluetooth of the device is in O /O ON/OFF mode. If the Bluetooth of the device is in OFF mode then application makes the request to enable the bluetooth the request to enable the bluetooth. After clicking on Connect a device on option menu the Application performs scanning for the devices which are in their range performs scanning for the devices which are in their range. Then it displays the list of all devices in the range. Select the device with which one wants to do the chat. If the device connects then set up the chat session. 3 RockyJagtiani TechnicalHead Suven Consultants Workflow of the project Main xml message xml device_list. Device_name. Main.xml message.xml xml xml Takestheview from Takestheview from Takesthenameof newdevice Displaysthechatting betweentwousers BluetoothChat.java DeviceListActivity.java BluetoothChat Application Thisisthemainactivity thatdisplaysthecurrent Thisactivityappearsas dialogueanddisplayslist ofallpairedandnew Application chatsession This activity does all the work of setting devices BluetoothChatService. Thisactivitydoesalltheworkofsetting upandmanagingbluetooth chat java 4 RockyJagtiani TechnicalHead Suven Consultants Correct and Incorrect cases in Bluetooth chat Correct case : Correct case : First open the application. Click the Option Menu and then click on connect a device. Click the Option Menu and then click on connect a device. Scan for new device if necessary. Select the device with which you want to chat. Once you are connected, you can perform bluetooth chat. Incorrect Case : If we try to chat if the device is not connected then the application will give the Toast message as You are not connected to the device! 5 RockyJagtiani TechnicalHead Suven Consultants Bluetooth APIs BluetoothAPIs The application framework provides access to the The application framework provides access to the Bluetooth functionality through the Android Bluetooth APIs. These APIs let applications wirelessly connect to other Bluetooth devices, enabling pointtopoint other Bluetooth devices, enabling point to point and multipoint wireless features. Android Bluetooth APIs are used to perform four Android Bluetooth APIs are used to perform four major tasks setting up BT, finding devices, connecting them and transferring data. g g RockyJagtiani TechnicalHead Suven Consultants 6 UI of Bluetooth chat application 7 RockyJagtiani TechnicalHead Suven Consultants This application can be used in: Thisapplicationcanbeusedin: _____________________________________ _____________________________________ _____________________________________ _____________________________________ _____________________________________ _____________________________________ _____________________________________ _____________________________________ _____________________________________ RockyJagtiani TechnicalHead Suven Consultants 8