Android bluetooth chat application

December 15, 2016 | Author: gemlemi | Category: N/A
Share Embed Donate


Short Description

Android Bluetooth chat application...

Description

"Sharpening Skills..... Serving Nation"

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459 (Online), Volume 4, Special Issue 1, February 2014) International Conference on Advanced Developments in Engineering and Technology (ICADET-14), INDIA.

A Complete Study of Chatting Room System based on Android Bluetooth Rahul Verma1, Ruchit Gupta2, Manas Gupta3, Rahul Singh4 Moradabad Institute of Technology, Moradabad 1

[email protected] , [email protected], 4 [email protected]

Abstract-- Bluetooth chatting is an innovative approach to the mobile world. A low –power and low –cost connection is provided by the Bluetooth among mobile devices and their accessories. It is basically an open standard for implementing a short range wireless communication. This application allows two Android devices to carry out twoway text chat over Bluetooth. This shows the use of Bluetooth in terms of chatting. The paper contains design and implementation of Bluetooth Communication by using APIs of Android platform. The APIs wirelessly connect applications to other Bluetooth devices, enabling point-topoint and multipoint wireless features. Keyword:- Android, Component, Bluetooth, wireless communication, chat room.

I. INTRODUCTION The Android platform support for the Bluetooth network stack. It allows a device to wirelessly exchange data with other Bluetooth devices. The new vitality to the mobile space has injected because of the release of Android smart platform. Android is an operating system based on Linux kernel. It is designed for the touch screen mobile devices. The user interface of Android is based on direct manipulation. The Android system provides many Bluetooth APIs for developers to call.[1] Bluetooth technology allows users to exchange voice and data transmission between two or more devices. It is basically a wireless communication technology. Bluetooth technology is reflected in the low price, easy to control and non-visual distance limitations. Bluetooth is integrated into the android platform as an android mobile network communication module. Chat room is used to connect the Android phones into a local area network. It helps to communicate with each other.

3

[email protected] ,

By the help of the Bluetooth module, the Android phones can be divided into client and server. Chat can be accomplished only after the division of client and server. It is used to initialize the connection.

Fig 1: Bluetooth chat in two android devices

Bluetooth does not need a license around the globe for the working frequency band. In the connection initialization phase, firstly, it starts the application and search the Bluetooth devices. Second, it sends the signals to the server class. After this it can run, pause and stop the application. Third, it shows alert using setAlert function on every changing. Server goes active and sends the signals to other devices. Client class works to respond the other Bluetooth device server. This allows a two-way chat over Bluetooth. No GSM or Wi-Fi connection required. In addition to the person-to-person chat, chat rooms can be used to gather more than two persons at a time. II. B LUETOOTH ARCHITECTURE Bluetooth is a wireless technology standard for exchanging data over short distances. This low cost transmission technology for the handheld devices and various electronic products. Android Bluetooth system contains linux kernel, Bluetooth driver, Bluetooth protocol layers blueZ Bluetooth user library, blueZ adaptation layer.[2]

Lord Krishna College of Engineering (An ISO 9001:2008 Certified Institute) Ghaziabad, Uttar Pradesh, INDIA.

Page 135

"Sharpening Skills..... Serving Nation"

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459 (Online), Volume 4, Special Issue 1, February 2014) International Conference on Advanced Developments in Engineering and Technology (ICADET-14), INDIA. III. P ROCESS OF B LUETOOTH CHAT APPLICATION i. ii.

iii. iv. v. vi.

It first checks whether the Bluetooth of the devices is in ON/OFF mode. If the Bluetooth of the devices is in OFF mode then it makes the request to enable the Bluetooth. Perform scanning of the devices which are in their range. Display the list of all the 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.

IV. DESIGN O F B LUETOOTH COMMUNICATION

Fig 2: Android Bluetooth structure

Bluetooth can be used to transmit asynchronous data and synchronous language at the same time. L2C AP, SDP, RFCOMM etc are underlying protocol layer include a number of agreements. It provides the upper transmission.

In the Android platform Bluetooth API is needed to implement the communication between the Bluetooth devices. The Bluetooth communication is based on the unique MAC. Bluetooth devices must been paired before using Bluetooth communication for the security purpose. The connected devices will be shared with a RFCOMM channel to transmit data. RFCOMM bluetoothSocket used to accept the incoming connections must be attached to operating system resources with the bind method. The process of Bluetooth communication includes three steps: i.

Query Bluetooth: BluetoothAdapter is used to get the Bluetooth Activity. It is the entry-point for all Bluetooth interaction and also it is used to discover other Bluetooth devices. It creates the BluetoothServerSocket to listen for communications from other devices. Bluetooth Adapter is also used to get the Bluetooth connection intent.[6] The query pairing process is shown in the following figure-

Fig 3: Relationship between Bluetooth Protocol

Lord Krishna College of Engineering (An ISO 9001:2008 Certified Institute) Ghaziabad, Uttar Pradesh, INDIA.

Page 136

"Sharpening Skills..... Serving Nation"

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459 (Online), Volume 4, Special Issue 1, February 2014) International Conference on Advanced Developments in Engineering and Technology (ICADET-14), INDIA. iii.

Connecting Bluetooth: Request the BLUETOOTH PERMISSION in order to perform any Bluetooth communication, such as requesting a connection, accepting a connection and ransferring the data. The process of pairing connection shown in the following diagram:

Fig 4: The pairing process

ii.

Finding devices: In this, it is needed to open the Bluetooth user name and MAC address to pair the Bluetooth.

Fig 5: Bluetooth pairing and Connection process

Lord Krishna College of Engineering (An ISO 9001:2008 Certified Institute) Ghaziabad, Uttar Pradesh, INDIA.

Page 137

"Sharpening Skills..... Serving Nation"

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459 (Online), Volume 4, Special Issue 1, February 2014) International Conference on Advanced Developments in Engineering and Technology (ICADET-14), INDIA.

Fig 6: Workflow of the Bluetooth Chat Room

V. DESIGN O F MODULES W ITH S AMPLE CODE i.

Discovering Devices: Device discovery is a scanning procedure and searches the local area for Bluetooth enabled devices. If the Bluetooth device is currently enabled to be discoverable then only it will respond to the discovery request. If the device is discoverable then it will respond by sharing some information such as device name, class and its unique MAC address. First time connection request automatically presented to the user. The information can be read using the Bluetooth APIs. Difference between paired and being connected are: Paired  Two devices are aware of each other’s existence.  They have a shared link-key that can be used for the authentication.  Capable of establishing an encrypted connection with each other.

To be connected  Devices currently share an RFCOMM channel.  Transmit data with each other.

Sample code : startDiscovery method is used in the class of BluetoothAdapater. It executes asynchronously, so we do not consider the thread is blocked. Whole process takes about 12 seconds[3]. Then register a BroadcastReceiver object to receive the Bluetooth device information. Then filter ACTION_FOUND intent to obtain the tailed information for each remote device. // Create a BroadcastReceiver for ACTION_FOUND private final BroadcastReceiver mReceiver = new BroadcastReceiver() { public void onReceive(Context context, Intent intent) { String action = intent.getAction(); // When discovery finds a device if (BluetoothDevice.ACTION_FOUND.equals(action)) { // Get the BluetoothDevice object from the Intent BluetoothDevice device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DE VICE); // Add the name and address to an array adapter to show in a ListView mArrayAdapter.add(device.getName() + "\n" + device.getAddress()); }}};

Lord Krishna College of Engineering (An ISO 9001:2008 Certified Institute) Ghaziabad, Uttar Pradesh, INDIA.

Page 138

"Sharpening Skills..... Serving Nation"

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459 (Online), Volume 4, Special Issue 1, February 2014) International Conference on Advanced Developments in Engineering and Technology (ICADET-14), INDIA. Paired Device: getBondedDevices() method is used in the pairing a Bluetooth device in the class BluetoothAdapter to obtain a paired device. This method returns the array of Bluetooth device to distinguish between each paired device. Sample code:

 

ii.

iv.

iii.

Establishing: For the establishment of a Bluetooth communication must go through :   

Get local Bluetooth devices; Find the remote device; Pairing;

Server Design: Server is needed to connect the two devices because it holds an open bluetoothserversocket. It is designed to listen for incoming connection requests. 

Set pairedDevices = mBluetoothAdapter.getBondedDevices(); // If there are paired devices if (pairedDevices.size() > 0) { // Loop through paired devices for (BluetoothDevice device : pairedDevices) { // Add the name and address to an array adapter to show in a ListView mArrayAdapter.add(device.getName() + "\n" + device.getAddress());}}

  v.

Connect devices; and Transfer data.

Call listenUsingRfcommWithServiceRecord(String, UUID) to get Bluetooth server socket. String = Name of the service, UUID = sign of connection Call the method accept() to listen for connection request and return a connection on Bluetooth socket bluetoothsocket. Call the method close() after listening to a connection to close the listener.

Client Design: Bluetooth Device object is used to initialize a connection. Obtain the Bluetooth socket and initialize the connection by the BluetoothDevice object.

Lord Krishna College of Engineering (An ISO 9001:2008 Certified Institute) Ghaziabad, Uttar Pradesh, INDIA.

Page 139

"Sharpening Skills..... Serving Nation"

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459 (Online), Volume 4, Special Issue 1, February 2014) International Conference on Advanced Developments in Engineering and Technology (ICADET-14), INDIA.

Fig 7: Detailed design of Bluetooth Chat Room[4]

VI. ADVANTAGE O F B LUETOOTH CHAT IN ANDROID i. ii. iii.

iv. v. vi. vii.

Low-power & low-cost wireless connection. Open standard short-range wireless communication. Bluetooth offers higher level service profiles, such as FTP-like file servers, voice transport, and more.[8] Innovative approach to the mobile world. No GSM or Wi-Fi connection required. Bluetooth does not need a license around the globe for the working frequency band. Low cost transmission technology for the handheld devices.

VII. LIMITATIONS O F C HATTING ROOM SYSTEM IN ANDROID B LUETOOTH i. ii.

iii.

Strangers can communicate with others using Bluetooth devices. Bluejacking, refers to people who send irrelevant, surprising, or shocking messages to strangers in their vicinity. Limited range to chat.[7]

VIII.

CONCLUSION AND F UTURE W ORKS

The internet age of today chat room is of a great entertainment features project. Most of the internet user likes it.

Lord Krishna College of Engineering (An ISO 9001:2008 Certified Institute) Ghaziabad, Uttar Pradesh, INDIA.

Page 140

"Sharpening Skills..... Serving Nation"

International Journal of Emerging Technology and Advanced Engineering Website: www.ijetae.com (ISSN 2250-2459 (Online), Volume 4, Special Issue 1, February 2014) International Conference on Advanced Developments in Engineering and Technology (ICADET-14), INDIA. Android provides the design and realization of chatting room system is good for developing Bluetooth network application and Bluetooth agreement. The system have realized the broadcast and private chat between mobile phones. But few still need to further improve the usability and functionality of the system like richer input format, the expression of information, pictures, information transmission etc.

[7]

[8] [9] [10]

REFERENCES [1] [2]

[3] [4] [5]

[6]

E2ECloud studio. Google Android[M] posts & telecom press. 2009 [2] The Bluetooth Special Interest Group. Bluetooth Specification Core v4.0 (2009-02). [3] Han Chao, Liang Quan, Principles and development points of the Android system[M]. Publishing House of Electronics industry. 2010 yang Fegsheng. Android Inside [M]. Machinery Industry Press. 2008 Andre N Klingsheim. J2ME Bluetooth Programming[D]. Department of informatics University of Bergen, 2004 W., ONGTANG, M., AND MCDANIEL, P. OnLightweight Mobile Phone Application Certification. In Proceedingsof the 16th ACM Conference on Computer and Communications Security (CCS) (Nov. 2009). ENCK, W., ONGTANG, M., AND MCDANIEL, P. Understanding Android Security. IEEE Security & Privacy Magazine 7, 1 (January/February 2009), 50–57.

[11] [12]

[13] [14]

FELMETSGER, V., CAVEDON, L., KRUEGEL, C., AND VIGNA, G. Toward Automated Detection of Logic Vulnerabilities inWeb Applications. In Proceedings of the USENIX Security Symposium (2010). FIRST TECH CREDIT UNION. Security Fraud: Rogue Android Smartphone app created. Dec. 2009. GOODIN, D. Backdoor in top iphone games stole user data, suit claims. The Register, November 2009. HOVEMEYER, D., AND PUGH, W. Finding Bugs is Easy. In Proceedings of the ACM conference on Object-Oriented Programming Systems, Languages, and Applications (2004). JOHNS, T. Securing Android LVL Applications. 2010. JUNG, J., SHETH, A., GREENSTEIN, B., WETHERALL, D.,MAGANIS, G., AND KOHNO, T. Privacy Oracle: A System for Finding Application Leaks with Black Box Differential Testing. In Proceedings of the ACM conference on Computer and Communications Security (2008). KASPERSKEY LAB. First SMS Trojan detected for smartphones running Android. August 2010. KIRDA, E., KRUEGEL, C., BANKS, G., VIGNA, G., AND KEMMERER, R. A. Behavior-based Spyware Detection. In Proceedings of the 15th USENIX Security Symposium (Aug. 2006).

Lord Krishna College of Engineering (An ISO 9001:2008 Certified Institute) Ghaziabad, Uttar Pradesh, INDIA.

Page 141

View more...

Comments

Copyright ©2017 KUPDF Inc.
SUPPORT KUPDF