Coder Social home page Coder Social logo

bluetoothkit-android's Introduction

Android Arsenal JitPack License MIT

BluetoothKit is an incredibly lightweight and simple open source library to interface with Bluetooth devices on Android.

Setup

Add this to your build.gradle

allprojects {
  repositories {
    ...
    maven { url 'https://jitpack.io' }
  }
}

then add the dependency

dependencies {
  implementation 'com.github.sirvar:bluetoothkit-android:v0.3'
}

Alternatively, you can add this to maven

<repositories>
  <repository>
    <id>jitpack.io</id>
    <url>https://jitpack.io</url>
  </repository>
</repositories>

and add the dependency

<dependency>
  <groupId>com.github.sirvar</groupId>
  <artifactId>bluetoothkit-android</artifactId>
  <version>0.3</version>
</dependency>

Usage

Initialize

val bluetoothKit = BluetoothKit()

Enable Bluetooth

bluetoothKit.enable()

Alternatively, you may also do:

bluetoothKit.isEnabled = true

Get Device

val device = bluetoothKit.getDeviceByName("Rikin's AirPods")

Connect Device

bluetoothKit.connect(device)

That's it

Check out the complete docs here

Apps currently using BluetoothKit:

If you're using BluetoothKit, feel free to make a PR and add it to the list

Made with โค by Rikin Katyal

bluetoothkit-android's People

Contributors

sirvar avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

bluetoothkit-android's Issues

List<GetConnectedAndPairedBluetoothDevicesModel>

Hi Sirvar,

Is or would something like this be implemented?
Would be great to get a list of current connected/paired devices (to do some validations & authentications (serverside))

** Any advice on below **
fun getPairedDevices(): Set {
return bluetoothAdapter.bondedDevices
}

Bluetooth Connected

Thank's for your job. This library is really very easy to use.
However, I can't understand how I can check if the device is connected and is active without getting errors.

Can you suggest an easy way to get this info?

Type Mismatch

Error

val device = bluetoothKit.getDeviceByName("HC-06")
bluetoothKit.connect(device)

Type Mismatch.
Required: BluetoothDevice
Found: BluetoothDevice?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.