Project Set Up Basics
For apps that utilize the BLE APIs, we like to go with Kotlin as the main language and we support a minimum API level of 21 . Check out our Android architecture post for more information on why we made these choices! Finally, make sure Use androidx.* artifacts is checked in the project wizard. If youre working on an existing project, ensure that youve migrated to AndroidX because .
Thoughts on Android best practices
To showcase the bare basics of working with Android BLE APIs, well be taking little shortcuts in our code snippets and example implementation to save time:
How To Pair And Connect A Bluetooth Device To Your Android Phone
First, you must turn on Bluetooth on your phone. There are two ways:
- Swipe down from the top of your screen using two fingers to open Quick Settings. Tap on the Bluetooth B icon to turn it on. Tapping and holding this button will take you to the Bluetooth settings page.
- Open Settings on your phone and tap on Bluetooth. On the next page, toggle on the button next to Bluetooth.
The Visible to other devices option should be enabled by default in Advanced Settings. If not, turn it on.
Next, make the Bluetooth device you’re connecting to discoverableit needs to be in range and visible to your Android phone for successful pairing.
The pairing process varies with each device, which you will find in the device’s user manual. Some products such as the and can enter pairing mode by saying, “Alexa, pair.” Others, like a laptop, will require you to match a six-digit pin on both devices.
On most devices like headphones or speakers, you need to simply press and hold either the power button or the pairing button with the Bluetooth symbol on it. You will either hear a sound briefly or a notification light will flash in pairing mode. Remember that the pairing mode is active only for a short time.
First Things First: Enable Bluetooth On Android And On Your New Device
Bluetooth is a versatile radio communication technology that allows you to wirelessly connect devices over small distances, but you first have to turn it on. So the first step is enabling the Android Bluetooth option on your smartphone or tablet. If you need help, here are 3 ways to turn on Bluetooth on Android.
First, turn on the Android Bluetooth
Enabling Bluetooth on accessories is a different process that varies between devices. Read the user manual that came with your Bluetooth device or check the manufacturers website for details on activating pairing or discovery mode. On most Bluetooth devices, its as easy as pressing-and-holding one button – either the Power button or the Pairing button, which should have the Bluetooth symbol next to it.
The Bluetooth Pairing button on a Sony speaker
Some devices go into discovery mode by default when you turn them on, while earbuds can be placed in pairing mode by simply opening their charging case. You should be able to tell if the Bluetooth device is ready to pair because it emits a flashing light or a short sound.
Keep in mind that pairing mode only lasts for a limited amount of time. So, if your device cant be found or you get interrupted during the setup of a Bluetooth device, try to enable pairing once more by following the steps provided by the manufacturer. If a paired Bluetooth device stops working, follow the steps in the appropriate chapters to delete its entry and reconnect it, as that might solve the issue.
You May Like: Best Budget Over Ear Bluetooth Headphones
Ii: Other Methods To Transfer Contacts From Android To Android
What are other ways to transfer contacts from one Android smartphone to another? Glad you asked. Because there are other ways to transfer contacts from an Android smartphone to another that do not use Bluetooth and can be both seamless and more powerful than the Bluetooth method, depending on your tastes and needs.
Android Bluetooth Example: Enable Disable And Make Discovrable Bluetooth Programmatically
You need to write few lines of code only, to enable or disable the bluetooth.
Drag one textview and three buttons from the pallete, now the activity_main.xml file will like this:
You need to provide following permissions in AndroidManifest.xml file.
The full code of AndroidManifest.xml file is given below.
Let’s write the code to enable, disable and make bluetooth discoverable.
You need to run it on the real device to test the application.
Next topics of android bluetooth tutorial:
Don’t Miss: Wireless Bluetooth Earbuds With Good Bass
Iiii: Transfer Contacts From An Android Smartphone To Another Using Manufacturer Apps
Now, if you have an LG phone, you might be more willing to use LG apps than, say, Xiaomi apps. Same for Xiaomi users who would probably scoff at using Samsung apps on their beloved Xiaomi devices. Manufacturers provide apps on Google Play Store that make transferring content from another device to their devices easy because that suits them to make the processes as seamless and easy for their customers. Even Apple is no different in that regard, they have an app to make it easy for people to switch from Android to iOS.
There are apps by most major manufacturers like Samsung and Xiaomi, including the older titans such as LG that have now stopped manufacturing phones recently. More or less, the steps that users would need to take to transfer contacts from their old devices to the new are fairly common, and you can use the app for your manufacturers, such as Mi Mover for Xiaomi and Samsung Smart Switch. Here is how to transfer contacts from old Android to new Samsung devices using Samsung Smart Switch.
Step 1: Download Samsung Smart Switch on both your old Android and the new Samsung device
Step 2: Keep the devices close by, say, on the table. This will not work if the devices are in different rooms or too far away.
Step 3: Launch Smart Switch on both the devices
Step 4: Tap Send Data on old Android
Step 5: Tap Receive Data on the new Samsung device
Step 6: Tap Wireless method on both devices
Step 9: Tap Transfer and when the transfer is done, tap Close.
Will It Cost Anything
It highly depends on your mobile provider and the country where you live. In most cases, the feature is free to use without restrictions. You can share the connection between all your devices.
Some providers do not limit tethering in packages with limited traffic but restrict it in their unlimited plans. Thus, you can easily share the connection if your plan includes, for example, 5 GB of data. Also, some providers do not allow tethering under any conditions or charge additionally for this feature.
So, contact your carrier to find out whether your plan allows tethering. If necessary, enable the respective options.
Don’t Miss: Install Bluetooth To Windows 10
Managing And Disconnecting A Bluetooth Device On Samsung Android
Managing Bluetooth devices and connections is not much different on Samsung Galaxy smartphones and tablets. Once paired and in range of your Android, turning the Bluetooth accessory on or off automatically connects or disconnects it. On top of that, you can tap on any name from the Paired devices list to stop or resume the Android Bluetooth connection for that gadget. For more settings, press the cogwheel icon next to a Bluetooth devices name.
Tap on the cogwheel next to the Bluetooth device you want to modify on Android
The switches on the next screen let you decide how to use your new Bluetooth device. Tap on Rename at the bottom to change the name of a Bluetooth device.
How to change Bluetooth device name on Samsung Android
How To Use Your Android Phone As A Bluetooth Mouse Or Keyboard
Joe Fedewa is a Staff Writer at How-To Geek. He has been covering consumer technology for over a decade and previously worked as a News Editor at XDA Developers. Joe loves all things technology and is also an avid DIYer at heart. He has written thousands of articles, hundreds of tutorials, and dozens of reviews. Read more…
You can use an Android device as a Bluetooth mouse or keyboard without installing anything on the connected device. This works for Windows laptops, Macs, Chromebooks, smart TVs, and nearly any platform you could pair with a regular Bluetooth keyboard or mouse. Heres how.
Using a phone or tablet as a wireless keyboard or mouse isnt a new idea. However, the downside to many solutions is that they require software on both ends. You need an app on your phone or tablet and a companion app on the receiving device.
The method that well show you only requires an app on your Android phone or tablet. The receiving device will then connect to it just like any other Bluetooth keyboard or mouse. Its a lot easier to set up and use.
For the best results, the receiving device should have Bluetooth 4.0 and run:
- Android 4.4 or higher
- Apple iOS 9, iPadOS 13, or higher
- Windows 10 or Windows 8 or higher
- Chrome OS
First, download Serverless Bluetooth Keyboard & Mouse for PC/Phone from the on your Android phone or tablet.
Choose Bluetooth Devices from the menu.
Recommended Reading: Best Small Wireless Bluetooth Speakers
How To Disable A Bluetooth Passkey On Android
A Bluetooth passkey is a numerical code that enables users to establish a Bluetooth connection between two devices. If one of your devices is an android phone, you need a Bluetooth passkey to make it happen.
On some devices, this code is referred to as the passcode or PIN.
One of the biggest reasons for Bluetooths popularity is its ease of use. You can connect a range of devices with a few clicks here and there. So for a lot of people, the added layer of entering a code can be stressful.While it is an important security measure, having the code seems futile. If youre one of these people, I am going to help you shed this burden in just a few easy steps.
But before that, here are all the reasons why the Bluetooth function by itself is an excellent feature.
You may know these things, but reinforcing the purpose of this wireless connection will help you whether or not you want the protection of a passkey.
Ble In The Android Sdk
Note: As explained in our Android BLE Development Tips blog post, well assume the app is targeting a minimum of API 21 due to the availability of better BLE APIs such as BluetoothLeScanner and ScanFilter.
We start this section off by introducing the main classes from the Android SDK that well be using.
Meeting the Android BLE API
|Class & Purpose|
|The main interface that the app has to implement in order to receive callbacks for most BluetoothGatt-related operations like reading, writing, or getting notified about incoming notifications or indications.|
Quick tips to navigate your way around the Android BLE API
If theres only one thing to take away from this post, its that Android doesnt like performing rapid, asynchronous, out-of-order BLE operations. Theres no internal queuing mechanism to guard against developer errors or ignorance were on our own.
We highlighted a few common pitfalls in Android BLE development in another post, so heres a quick summary:
Over the remainder of the post, well walk you through creating your own Android app that communicates with a BLE device. This post aims to provide a high level overview of how to perform BLE operations, so that you can read and follow along as you code. A full example implementation is available on our open source GitHub repo.
With the basic introductions and tips out of the way, its time to roll up our sleeves and start coding!
Don’t Miss: Bluetooth 5.1 Indoor Positioning
How Can You Find The Passkey On Your Android Phone
The first step to disabling the passkey is finding it.
Your Android phone is likely to come with a pre-set passkey. To find it, you can explore the Bluetooth menu on your mobile phone, generally located in the settings menu. When you go into the settings menu, you will see an option labeled get code. It will help you find your mobile phones passkey.
Using Your Phone As A Speaker For Your Pc
If your laptops speaker volume is too low when kept at a distance to watch movies with your friends, or if the speakers are broken altogether, then apps like SoundWire and WiFiAudio can be your savior. What these apps do is that they let you stream the audio of the movie or the video playing on your laptop through your phone, which you can keep near you for a clearer and louded sound.
To convert your phone into a speaker through SoundWire, you need to do the following steps.
- You need to first add it to your PC, which you can achieve by going to the Georgie Labs website and downloading the file suitable to your PC operating system.
- After installing it, you need to download the app from the play store on your smartphone.
- Then open the application on your phone and laptop and type the server address mentioned on the PC SoundWire application into the app on your phone to connect the two devices.
- And so your cell phone will stream the audio of whatever you play on your PC.
Another app that will let your phone act as a speaker for your PC is WiFiAudio. Some people prefer this over SoundWire because there is no audio latency. This programs setup is relatively similar to that of SoundWire, although there are a few additional steps you have to go through.
To connect your iPhone to your MacBook or PC for audio streaming, you need to follow these steps.
Also Check: Best Bluetooth Wireless Mouse For Laptop
How To Manage Bluetooth Settings On Android 10
Here is your go-to guide for using Bluetooth on Android 10.
Since the first days of smartphones, Bluetooth has been one of the fastest and most convenient methods of connecting to smart devices, home appliances and more.
Managing your Bluetooth settings now and again is important. Maybe youve used a number of headphones or speakers over the years and you need to clean up your settings. Or, perhaps you want to connect to something new. Either way, here is a basic guide on how to effectively manage your Bluetooth settings on Android 10.
How To Pair Your Keyboard
Setting up a Bluetooth keyboard with Android is very easy. First, youll need a Bluetooth keyboard and, of course, an Android device. For this example, Im using a Logitech Keys-to-Go keyboard.
In Android, enable Bluetooth if it isnt already on. To enable Bluetooth, simply go to Settings > Bluetooth and tap the slider button to On. Then, turn on your Bluetooth keyboard and put it into pairing mode.
On the Bluetooth screen, your Android device should automatically search for and find your keyboard. If you dont get it right the first time, simply turn the keyboard on again and then tap Search for Devices to try again. If it still doesnt work, make sure you have fresh batteries and the keyboard isnt paired to another device. If it is, you will need to unpair it before it will work with your Android device.
When Android finds your keyboard, select it under Available Devices and you should be prompted to type in a code.
If successful, you will see that device is now Connected and youre ready to go.
If you want to test things out, try pressing Windows+Esc on the keyboard , and you will be whisked to your Home screen.
Recommended Reading: Best Bluetooth Noise Cancelling Earbuds
How To Disable A Bluetooth Passkey
The disabling process itself is fairly straightforward. Simply follow these few steps, and it will be done.
Enable Bluetooth In Windows 10
The first step is making sure that Bluetooth is enabled on your Windows 10 computer or device. There are several ways to enable Bluetooth in Windows 10, and activating it from Settings is one of them. Open the Settings app by pressing Windows + I on your keyboard and access Devices. This opens the Bluetooth & other devices tab, where you should see the Bluetooth switch on the right. If Bluetooth is turned Off, click or tap on its switch to turn it On.
Enable Bluetooth in Windows 10
As long as you keep the Bluetooth settings open, your Windows 10 PC can be discovered by other devices using Bluetooth.
IMPORTANT: If you dont see a switch in the Settings app, your Windows 10 computer or device might not have a built-in Bluetooth chip. As a result, you cannot make a Bluetooth connection unless you add a Bluetooth adapter, like this one.
Read Also: Wireless Bluetooth Transmitter For Car