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

  • SEARCH
  • Home
  • 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 6172255
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T23:21:39+00:00 2026-05-23T23:21:39+00:00

Recently I tried to get a pairing process to work programatically and I succeded.

  • 0

Recently I tried to get a pairing process to work programatically and I succeded. But I recently found out that the users of my application can be connected to several of “interesting” devices. So I have to prompt the user to choose a device to connect to

So I have to connect the user to a already paired bluetooth device. But none of my efforts work. I tried running the pairing process again using the:

tmp = device.createRfcommSocketToServiceRecord(MY_UUID);

and also the following:

Method m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
mmSocket = (BluetoothSocket) m.invoke(mmDevice, 1);

which is the one I’ve implemented and the only working way to pair my phone with my embedded bluetooth device

So my question is:

  • Is it possible for me to disconnect a paired device and then connect to another embedded device? I tried.. to simply connect to the new device but I can’t get that to work
  • 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-23T23:21:40+00:00Added an answer on May 23, 2026 at 11:21 pm

    I’m afraid I’m not entirely sure what your problem is. Is it that you are unable to create a socket to an already paired bluetooth device?

    First of all, if the device is already paired, you don’t need to run the pairing process again. You just need to create the socket for communication, which will fail if the device is not available to communicate with. I’ve been doing some stuff around this lately and I’ve used the following code, which has worked fine for me:

        try {
            Method m = device.getClass().getMethod("createRfcommSocket",
                    new Class[] { int.class });
            BluetoothSocket mySocket = (BluetoothSocket) m.invoke(device, Integer.valueOf(1));
    
        } catch (<VARIOUS EXCEPTIONS>) {
            //Do stuff
        }
    

    For prompting the user to select which device, you can query the BluetoothAdapter for all the currently paired devices as follows:

    Set<BluetoothDevice> bondedDevices = BluetoothAdapter
                .getDefaultAdapter().getBondedDevices();
    

    Finally, it is possible to create connections to multiple devices at the same time – have a look here: Android Bluetooth API connect to multiple devices

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

Sidebar

Related Questions

I recently learned that I can get hg log to print the history in
I've tried looking on google but i guess I can just not get the
I've recently found swingx and wanted to experiment with JXCollapsiblePane. But i cant get
I recently tried to combine SEAM and GWT in a project - but failed
I have been recently digging into Mobile Programming, I practically tried out the J2ME
I recently tried building my own shared and weak pointers. Code that compiles using
I've recently installed Wordpress and can't seem to get the website to display friendly
I've recently tried to get the full picture about what steps it takes to
We have an application that uses various system tray icons to communicate with users.
Recently I was trying to make a calendar application that will display the current

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.