Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6735779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T11:03:11+00:00 2026-05-26T11:03:11+00:00

I am developing an application which should connect 2 Android devices through Bluetooth automatically.

  • 0

I am developing an application which should connect 2 Android devices through Bluetooth automatically. Let’s say they are already paired. Is it possible to achieve that?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T11:03:12+00:00Added an answer on May 26, 2026 at 11:03 am

    Of course it is possible. I’ll make a short tutorial out of the documentation:

    Start with the BluetoothAdapter – it is your Bluetooth manager.

    BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    

    If bluetoothAdapter is null, it means that this Android device does not support Bluetooth (It has no Bluetooth radio. Though I think it’s rare to encounter these devices…)

    Next, make sure Bluetooth is on:

    if (!bluetoothAdapter.isEnabled()) {
          Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); 
          startActivityForResult(enableBtIntent, request_code_for_enabling_bt);
    }
    

    If it’s not on, we start the activity which asks the user to enable it.

    Let’s say the user did enable (I guess you should check if he did, do it in your onActivityResult method). We can query for the paired devices:

    Set<BluetoothDevice> pairedDevices = bluetoothAdapter.getBondedDevices();
    

    Then loop over them: for(BluetoothDevice device : pairedDevices) and find the one you want to connect to.

    Once you have found a device, create a socket to connect it:

    BluetoothSocket socket = device.createRfcommSocketToServiceRecord(YOUR_UUID);
    

    YOUR_UUID is a UUID object containing a special ID of your app. Read about it here.

    Now, attempt to connect (The device you are trying to connect to must have a socket created with the same UUID on listening mode):

    socket.connect();
    

    connect() blocks your thread until a connection is established, or an error occurs – an exception will be thrown in this case. So you should call connect on a separate thread.

    And there! You are connected to another device. Now get the input and output streams:

    InputStream is = socket.getInputStream();
    OutputStream os = socket.getOutputStream();
    

    and you can begin sending/receiving data. Keep in mind that both actions (sending and receiving) are blocking so you should call these from separate threads.

    Read more about this, and find out how to create the server (Here we’ve created a client) in the Bluetooth documentation.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am developing an application which uses Bluetooth to connect to a device and
I am developing an application which should connect to an open WiFi access point
I am developing an application that is using bluetooth to automatically connect to nearby
I am developing a rails application which should send push notifications to iOS devices.
I am developing an Universal application in android which should run on android phone
I am developing an application for pocket PC which should run in landscape mode.
When developing a new web based application which version of html should you aim
I have heard that when developing application which uses a database you should do
We are looking for an approach for developing a web based application which should
I am developing an application which should work under different languages (german, spanish, etc).

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.