We provide complete mobile and web apps development solutions

Showing posts with label bluetooth adapter. Show all posts
Showing posts with label bluetooth adapter. Show all posts

Tuesday, January 29, 2013

Bluetooth -Android Programming

  Android supports Bluetooth for wireless connectivity. It comes with API of android bluetooth.


We have different classes in the API

BluetoothAdapter: It represents local Bluetooth Adapter.Using this class, we can discover the devices near by.Uisng this we can create BluetoothServerSocket for listening from other devices.

 BluetoothDevice: By using this we can request connection to remote device through BluetoothSocket.


BluetoothSocket: We can exchange the data with other Bluetooth Device.

BluetoothServerSocket: it listens the incoming request. To connect any device, one device  must open a server socket.


BluetoothProfile:It is an interface for wireless devices.

Bluetooth: Using this class, we can connect to Bluetooth Headset.

BluetoothHealth: It represents a health device profile that controls Bluetooth service.
BluetoothA2dp(Advanced Audio Distribution Profile): It tells how audio quality streamed from one mobile to other .

BluetoothProfile.ServiceListener: It gives notification when the client connects or disconnects.


To use Bluetooth in Android, we need to declare permissions in manifest.xml


 <uses-permission android:name="android.permission.BLUETOOTH" />
 <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />



How to check whether the device support Bluetooth or not?

BluetoothAdapter btAdapter=BluetoothAdapter.getDefaultAdapter();
if( btAdapter==null){
//device doesnot support Bluetooth.
 }
else{ //device support bluetooth.


How to enable Bluetooth:
 //Prompt user to turn on Bluetooth
Intent enableI = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
    startActivityForResult(enableI, REQUEST_ENABLE_BT);




        // Set up a pointer to  remote node using address.
        BluetoothDevice device = btAdapter.getRemoteDevice(address);
 



/ Establish connection. 
  bltSocket.connect();

Monday, January 28, 2013

What is Bluetooth?

-->
        Bluetooth is a wireless technology for connecting shortest distance clients(creates personnel area network) within the range of 10 meters with the frequency of 2.4 GHZ of unlicensed band. To connect to the other client, the client also have Bluetooth. It is the greatest technology for replacing the cables for short distances.
     If we compare to the other systems, Bluetooth file transfer is faster packet transfer. It uses fastest acknowledgement, frequency hopping and unlicensed ISM band.

  At Present, most of the electronic goods coming with Bluetooth technology like Tv, mouse, audio devices, mobiles, remotes, computers etc.

cost of the Bluetooth device is cheaper than any other wireless technology.


How to use the Bluetooth and how to connect to other Bluetooth device programatically we can see in later topics.


  
 

Online Training

Your Name :
Your Email: (required)
Your Message: (required)

Powered by Blogger.

Recent Posts

Find Us On Facebook

Popular Posts