Connect bluetooth paired devices

Programmatically connect to paired Bluetooth device

Is there a way, using the Android SDK, to programmatically connect to an already-paired Bluetooth device? In other words: I can go into Settings -> Wireless & networks -> Bluetooth settings, and tap the device (listed as «Paired but not connected»), at which point it will connect. I’d like to be able to do this programmatically, but don’t see a way to do this. I see the options to create an RFCOMM socket, and for a SPP device, I’m assuming that’ll do the connection part as well, but for an A2DP device, where the actual data transfer will be handled by the OS rather than by my app, I think that’s not applicable?

4 Answers 4

Okay, since this was driving me crazy, I did some digging into the source code and I’ve found a 100% reliable (at least on my Nexus 4, Android 4.3) solution to connect to a paired A2DP device (such as a headset or Bluetooth audio device). I’ve published a fully working sample project (easily built with Android Studio) that you can find here on Github.

Essentially, what you need to do is:

  • Get an instance of the BluetoothAdapter
  • Using this instance, get a profile proxy for A2DP:

adapter.getProfileProxy (context, listener, BluetoothProfile.A2DP);

where listener is a ServiceListener that will receive a BluetoothProfile in its onServiceConnected() callback (which can be cast to a BluetoothA2dp instance)

Method connect = BluetoothA2dp.class.getDeclaredMethod(«connect», BluetoothDevice.class);

String deviceName = "My_Device_Name"; BluetoothDevice result = null; Set devices = adapter.getBondedDevices(); if (devices != null) < for (BluetoothDevice device : devices) < if (deviceName.equals(device.getName())) < result = device; break; >> > 

Which, at least for me, caused an immediate connection of the device.

Источник

Pair a Bluetooth device in Windows

You can pair all kinds of Bluetooth devices with your PC—including keyboards, mice, phones, speakers, and a whole lot more. To do this, your PC needs to have Bluetooth. Some PCs, such as laptops and tablets, have Bluetooth built in. If your PC doesn’t, you can plug a USB Bluetooth adapter into the USB port on your PC to get it.

Before you start, make sure that your Windows 11 PC supports Bluetooth. For more info on how to check, see Fix Bluetooth problems in Windows. If you need help adding a device without Bluetooth capabilities, see Add a device to a Windows PC.

Turn on Bluetooth

After you’ve checked that your Windows 11 PC supports Bluetooth, you’ll need to turn it on. Here’s how:

  • In Settings: Select Start >Settings >Bluetooth & devices , and then turn on Bluetooth .
  • In quick settings: To find the quick setting for Bluetooth, select the Network, Sound, or Battery icons ( ) next to the time and date on the right side of your taskbar. Select Bluetooth to turn it on. If it’s turned on without any Bluetooth devices connected, it might appear as Not connected .

The Bluetooth button in

To pair a Bluetooth device

  1. Turn on your Bluetooth device and make it discoverable. The way you make it discoverable depends on the device. Check the device or visit the manufacturer’s website to learn how.
  2. On your PC, select the Network , Sound, or Battery icons ( ) next to the time and date on the right side of your taskbar.
  3. Select Manage Bluetooth devices on the Bluetooth quick setting, then select your device under New devices.

The Manage Bluetooth devices button in Quick Settings.

  • Follow additional instructions if they appear, then select Done.
  • Your Bluetooth device and PC will usually automatically connect anytime the two devices are in range of each other with Bluetooth turned on.

    Tip: If you don’t see the Bluetooth device you want displayed in the list, you may need to set the Bluetooth devices discovery setting to Advanced. To learn how, see Fix Bluetooth problems in Windows.

    To pair a Bluetooth printer or scanner

    1. Turn on your Bluetooth printer or scanner and make it discoverable. The way you make it discoverable depends on the device. Check the device or visit the manufacturer’s website to learn how.
    2. Select Start >Settings >Bluetooth & devices >Printers & scanners >Add device. Wait for it to find nearby printers, choose the one you want to use, then select Add device.

    If you’re having problems installing your printer or scanner, see either Fix printer problems or Install and use a scanner in Windows.

    To pair a Bluetooth device using Swift Pair

    Swift Pair in Windows 11 lets you quickly pair a supported Bluetooth device with your PC. If the Bluetooth device supports Swift Pair, you’ll receive a notification when it’s nearby and you put it into pairing mode to make it discoverable.

    1. Turn on a Bluetooth device that supports Swift Pair and make it discoverable. The way you make it discoverable depends on the device. Check the device or visit the manufacturer’s website to learn more.
    2. If this is your first time using Swift Pair, select Yes when asked if you want to get notifications and use Swift Pair.
    3. When a notification appears that a new Bluetooth device was found, select Connect.

    Before you start, make sure that your Windows 10 PC supports Bluetooth. For more info on how to check, see Fix Bluetooth problems in Windows 10. If you need help adding a device without Bluetooth capabilities, see Add a device to a Windows 10 PC.

    Turn on Bluetooth

    After you’ve checked that your Windows 10 PC supports Bluetooth, you’ll need to turn it on. Here’s how:

    In Settings: Select Start > Settings > Devices > Bluetooth & other devices, and turn on Bluetooth.

    In action center: Action center can be found next to time and date on your taskbar. On the taskbar, select action center ( or ), then select Bluetooth to turn it on. If it’s turned off, it might appear as Not connected.

    If you don’t see Bluetooth in your action center, here’s how you can change it:

    • Expand quick actions. On the taskbar, select action center ( or ) >Expand. Bluetooth should appear here. It will appear as Bluetooth or Not connected.
    • Add Bluetooth to action center. Select Start >Settings >System >Notifications & actions >Quick actions. Go to Add or remove quick actions and turn on Bluetooth.

    Note: For more info about how to change the apps and settings that appear in action center, see Change notification and action settings in Windows 10.

    To pair a Bluetooth headset, speaker, or other audio device

    1. Turn on your Bluetooth audio device and make it discoverable. The way you make it discoverable depends on the device. Check the device or visit the manufacturer’s website to learn how.
    2. On your PC, select Start >Settings >Devices >Bluetooth & other devices >Add Bluetooth or other device >Bluetooth. Choose the device and follow additional instructions if they appear, then select Done. Your Bluetooth device and PC will usually automatically connect anytime the two devices are in range of each other with Bluetooth turned on.

    To pair a Bluetooth keyboard, mouse, or other device

    1. Turn on your Bluetooth keyboard, mouse, or other device and make it discoverable. The way you make it discoverable depends on the device. Check the device or visit the manufactur’s website to learn how.
    2. On your PC, select Start >Settings >Devices >Bluetooth & other devices >Add Bluetooth or other device >Bluetooth. Choose the device and follow additional instructions if they appear, then select Done.

    To pair a Bluetooth printer or scanner

    1. Turn on your Bluetooth printer or scanner and make it discoverable. The way you make it discoverable depends on the device. Check the device or visit the manufacturer’s website to learn how.
    2. Select Start >Settings >Devices >Printers & scanners >Add a printer or scanner. Wait for it to find nearby printers, then choose the one you want to use and select Add device.

    If you’re having installation issues with your printer or scanner, see either Fix printer problems or Install and use a scanner in Windows 10.

    To pair a Bluetooth device using Swift Pair

    Swift Pair in Windows 10 lets you quickly pair a supported Bluetooth device with your PC. If the Bluetooth device supports Swift Pair, you’ll receive a notification when it’s nearby and you put it into pairing mode to make it discoverable.

    1. Turn on a Bluetooth device that supports Swift Pair and make it discoverable. The way you make it discoverable depends on the device. Check the device or visit the manufacturer’s website to learn more.
    2. If this is your first time using Swift Pair, select Yes when asked if you want to get notifications and use Swift Pair.
    3. When a notification appears that a new Bluetooth device was found, select Connect.
    4. After it’s connected, select Close.

    Tip: If you’re a small business owner looking for more information on how to get Microsoft 365 set up, visit Small business help & learning.

    Источник

    Pairing Bluetooth mobile devices in 3 steps

    bluetooth_in_mobiles

    Nowadays this wireless technology is a common standard that allows us to connect different types of units without any cables or cords. What is Bluetooth used for? It may be used to join a mobile to a car, to join headset to our phone, to use wireless keyboard and mouse with tablet or phone, to act our phone as a modem, to connect mobile to mobile, etc. The average working distance for this technology is not more than about 10 meters so we shouldn’t move connected ones too far from each other.

    Today the mobiles are very popular. The total count of them is more that people in the world. So we should know how to connect Bluetooth to the phone to stay modern.

    The second device type is varied. One of the most popular wireless gadgets for mobile is a headset. Here is a manual on how to connect the Bluetooth headset unit in 4 steps. Another popular option is pairing a phone with car.

    The generic main steps are

    We don’t need to connect the units again in further. They automatically connect when they are in the range of each other with wireless mode turned on. Note that using modern technology can increase the level of battery utilization, so we should check the charge level on both units regularly.

    Turn off the wireless mode just in case of stop usage. Remove each one from a paired list of other one to completely unpair Bluetooth devices if needed.

    The most mobiles released after 2007 have this technology onboard. We may always check it through finding an appropriate setting on the one. Below are detailed pairing instructions for different types such as

    How to connect Bluetooth on iPhone and iPad#

    Ensure that wireless mode is on, do the same on the second unit and tap on its name in the list of available equipment. The user interface is quite the same for iPad by thanks to Apple.

    ios_bluetooth_devices_list

    Check Bluetooth passkey (or enter it if necessary) and choose “Pair” to accept the connection.

    ios_bluetooth_passkey_validation

    Now the mobile and the other unit are paired.

    Open it details via information icon and choose “Forget this Device” to unpair the device if necessary.

    ios_bluetooth_disconnect_device

    Attach Bluetooth on Android phone and tablet#

    Ensure that wireless technology is on in “Settings\Bluetooth” and tap on the particular available device that must be wirelessly activated too. Repeat search by “Search for devices” or similar if we can’t find a particular unit in the list.

    android_bluetooth_devices_list

    Check passkey for Bluetooth (or enter it if necessary) and confirm the connection.

    android_bluetooth_passkey_validation

    Open it details via configuration icon and choose “Unpair” to disconnect the unit. Also, we can set own local name of paired one via “Rename”.

    android_bluetooth_disconnect_device

    How to connect Bluetooth on Windows Phone#

    Make sure that the mode is on (look at the below picture) and get the list of available ones. The second one should be enabled too. Then find and tap on the second unit name.

    windows_phone_bluetooth_devices_list

    windows_phone_bluetooth_passkey_validation

    Now the mobile and the other unit are paired.

    Tap on device in the list and confirm deletion to unpair it in case of no need.

    Источник

    Читайте также:  Turning on bluetooth on mac
    Оцените статью
    Adblock
    detector