- Saved searches
- Use saved searches to filter your results more quickly
- License
- JimSeker/bluetooth
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- Android — Bluetooth Connection Demo
- Step 1 Check Bluetooth Connection
- Step 2 MainActivity.java file
- Tejas Jasani
- Saved searches
- Use saved searches to filter your results more quickly
- License
- bauerjj/Android-Simple-Bluetooth-Example
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
- Saved searches
- Use saved searches to filter your results more quickly
- License
- Pixplicity/android-bluetooth-demo
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Android Bluetooth examples
License
JimSeker/bluetooth
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
BlueToothDemo is a simple example of how to startup a bluetooth client and server. You will need to install this example on two devices (not the simulators, doesn’t work there). Once the connections are made, it just like any other network code.
ControllerSimpleDemo is a simple demo for using a bluetooth controller like a joystick or game controller
controller is a google’s example for the Controller. Nothing was changed, only it’s now setup for studio.
BLEScannerDemo scan for ble devices and attempts to connect them via the gatt classes
BluetoothLEDemo is example of how the advertise and discovery via BLE
BluetoothLEperipheral is an all in one BLE example I got from another example and updated.
AndroidBeaconLibraryDemo Based on the https://altbeacon.github.io/android-beacon-library/index.html library, it looks for a displays beacons. This is a very simple example.
AndroidBeaconLibraryDemo2 Based on the https://altbeacon.github.io/android-beacon-library/index.html library, displays the monitor in one fragment and range information another fragment.
These are example code for University of Wyoming, Cosc 4730 Mobile Programming course and cosc 4735 Advance Mobile Programing course. All examples are for Android.
Android — Bluetooth Connection Demo
Bluetooth:The Android platform supports Bluetooth connection, which allows exchanging data with other Bluetooth devices. The application framework provides access to the Bluetooth functionality through the Android Bluetooth APIs connect to other Bluetooth devices.
All of the Bluetooth APIs is available in the Android Bluetooth package.
Here is a summary of the classes you will need to create as below:
BluetoothAdapter | Represents the local Bluetooth adapter (Bluetooth radio). |
BluetoothDevice | Represents a remote Bluetooth device, query information such as its name, address, class, and bonding state. |
BluetoothSocket | Represents the interface for a Bluetooth socket (similar to a TCP Socket). |
BluetoothServerSocket | Represents an open server socket that listens for incoming requests (similar to a TCP ServerSocket). |
BluetoothClass | Describes the general characteristics and capabilities of a Bluetooth device. |
In our example we are going to create an application which get the information about the Bluetooth connections is activates and deactivates Bluetooth.
Step 1 Check Bluetooth Connection
First we need check Bluetooth connection. So Create new class named Connections.
public class Connections < private static boolean state = false; public static boolean blueTooth() < BluetoothAdapter bluetooth = BluetoothAdapter.getDefaultAdapter(); if (!bluetooth.isEnabled()) < System.out.println("Bluetooth is Disable. "); state = true; >else if (bluetooth.isEnabled()) < String address = bluetooth.getAddress(); String name = bluetooth.getName(); System.out.println(name + " : " + address); state = false; >return state; > >
Step 2 MainActivity.java file
Now when we got the response from the Connections class in our Main Activity with BT in Off state we get dialog for On BT.
Then we create new method into main activity class for the setting up all the Bluetooth information into Text View.
public class MainActivity extends Activity < private static final int REQUEST_ENABLE_BT = 12; private TextView out; private BluetoothAdapter adapter; @Override public void onCreate(Bundle savedInstanceState) < super.onCreate(savedInstanceState); setContentView(R.layout.main); out = (TextView) findViewById(R.id.tvBluetoothInfo); setBluetoothData(); if (Connections.blueTooth()) < Intent enableBtIntent = new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE); startActivityForResult(enableBtIntent, REQUEST_ENABLE_BT); >> @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) < // TODO Auto-generated method stub super.onActivityResult(requestCode, resultCode, data); out.setText(""); setBluetoothData(); >private void setBluetoothData() < // Getting the Bluetooth adapter adapter = BluetoothAdapter.getDefaultAdapter(); out.append("\nAdapter: " + adapter.toString() + "\n\nName: " + adapter.getName() + "\nAddress: " + adapter.getAddress()); // Check for Bluetooth support in the first place // Emulator doesn't support Bluetooth and will return null if (adapter == null) < Toast.makeText(this, "Bluetooth NOT supported. Aborting.", Toast.LENGTH_LONG).show(); >// Starting the device discovery out.append("\n\nStarting discovery. "); adapter.startDiscovery(); out.append("\nDone with discovery. \n"); // Listing paired devices out.append("\nDevices Pared:"); Set devices = adapter.getBondedDevices(); for (BluetoothDevice device : devices) < out.append("\nFound device: " + device.getName() + " Add: " + device.getAddress()); >> >
For More Details visit following links:
I hope you enjoy this tutorial and it would be helpful to you.
Got an Idea of Android App Development? What are you still waiting for? Contact us now and see the Idea live soon. Our company has been named as one of the best Android App Development Company in India.
Tejas Jasani
An entrepreneur who has founded 2 flourishing software firms in 7 years, Tejas is keen to understand everything about gaming — from the business dynamics to awesome designs to gamer psychology. As the founder-CEO of a company that has released some very successful games, he knows a thing or two about gaming. He shares his knowledge through blogs and talks that he gets invited to.
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Simple Android Bluetooth example to turn on/off radio and to view and connect with devices. Has associated code to connect to an Arduino.
License
bauerjj/Android-Simple-Bluetooth-Example
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
* Translation in italian Added file strings.xml in italian * Italian translation work finished
Git stats
Files
Failed to load latest commit information.
README.md
A simple Android bluetooth example to turn on/off the radio and to view and connect with other devices. It has associated embedded firmware code to connect to an Arduino to test the bi-directional data stream.
For a complete tutorial write-up, please see here:
This is a simple demo app that creates buttons to toggle ON/OFF the bluetooth radio, view connected devices, and to discover new bluetooth enabled devices. A checkbox and status strings provide functionality to communicate with an embedded microcontroller such as an Arduino. You don’t necessarily need to connect an Arduino to still have a functioning phone application. The connected device MUST abide by the Serial Port Profile (SPP). Other complex profiles are not supported with this example and will fail to connect.
- Android Studio IDE and SDK
- HC-06 bluetooth module
- Arudino Uno
- A few breadboard wires to connect the HC-06 to the Arduino
- Clone this repo and open it inside of Android Studio. Note, a later SDK will work just fine (SDK 23+)
- Build the app
- Install the app to your connected Android phone. You will need to install special drivers and enable USB debugging on your phone for this to work. There are plenty of tutorials on the web for this.
- Clone this Arudino gist and program your Arudino
- Run the application on your phone after it installs. Connect to the HC-06 and you should see a number incrementing on the application every second.
Please submit all issues to the github tracker. Pull requests are also encouraged. General comments can be left either inside github or at mcuhq.com.
About
Simple Android Bluetooth example to turn on/off radio and to view and connect with devices. Has associated code to connect to an Arduino.
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
This project demonstrates communicating with a bluetooth device in an Android app.
License
Pixplicity/android-bluetooth-demo
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Android Bluetooth LE Demo
Bluetooth Low Energy is a special version of Bluetooth that allows wireless communication with devices using very little power, which makes it suitable for mobile phones as well as battery powered devices such as beacons, heart rate monitors and other sensors. It has been available in Android since 4.3 (Jelly Bean).
This project demonstrates how to communicate with a device using Bluetooth LE. It is set up as a working app project that you can import into Android Studio or compile using Gradle from the command line. It covers searching for nearby devices, sending data and receiving updates from the remote device.
Some UUIDs of services and characteristics are hard-coded in the project. If you know the UUIDs of the device you’re testing with you should alter those values before running the project.
This app covers the following topics:
- Checking if Bluetooth is enabled and requesting the user to enabled it if needed
- Starting a search for Bluetooth devices
- Connecting to a device of interest
- Sending a byte to the remote device
- Receiving updates whenever a value on the remote device changes.
Note that we use the Jelly Bean (4.3) APIs for communication, even though those are deprecated in Lollipop (5.0), because the new APIs are only available from 5.0 and up.
About
This project demonstrates communicating with a bluetooth device in an Android app.