Friday, May 20, 2011

Simple bluetooth chat application for iPhone

One of the features available in iPhone OS 4.0 is the GameKit framework. The GameKit framework contains APIs to allow communications over a Bluetooth network. Using these APIs, you can create peer-to-peer games and applications with ease. Unlike other mobile platforms, using Bluetooth as a communication channel in iPhone is way easier than expected.

By using this framework you can ON bluetooth of your iPhone manually, but still there is no chance to OFF the bluetooth manually.

I had attached sample code of this application..its very simple to understand.

Steps to test a code:



Once the application is deployed to the two devices, launch the application on both devices. On each device, tap the Connect button. The GKPeerPickerController will display the standard UI to discover other devices .

After a while, both application should be able to find each other. When you tap on the name of the found device, the application will attempt to connect to it.
When another device tries to connect to you, you will see the popup. Tap on Accept to connect and Decline to decline the connection.

If you are connected, you can now enter some text and start sending to the other device. Data received from another device will be shown in an alert view .


And finally here you will get SOURCE CODE for this tutorial..


4 comments:

  1. sorry friend now iam able to download thaks

    ReplyDelete
  2. hi parsh,
    is that possible to connect to other devices other than iphone to chat
    i mean a blue tooth adapter fixed in windows machine

    ReplyDelete
  3. You can connect only two or more ios device with each other, for other refer Btstack on google code.

    ReplyDelete