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 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 forked https://github.com/fortuity/rails3-mongoid-omniauth and tried to get login working for different providers. It
I've been working recently on some animations and it struck me that there is
I can't get Netbeans to auto-complete my selectors for JQuery, example: <a id=hello href=#>Hello</a>
Previously .NET SQLite libraries were available from http://sqlite.phxsoftware.com , but they have recently been
I recently got a new primary computer. On my old one, I was working
I need to flip a div panel left once a some item div get
Our project switched over from SVN to Mercurial recently. In SVN, to version our
I have some code here. I recently added this root_id parameter. The goal of
I have a draft apk, unpublished, up on the android market store and I've
A while ago I wrote an app and I was able to install it

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.