Skip to content

CodeFishStudio/rn-android-ble-watcher

Repository files navigation

React Native Android BLE Watcher

Watches for Bluetooth Connections and runs background task

Installation

npm install rn-android-ble-watcher

Usage

BackgroundTask.js

module.exports = async (args) => {
    console.log('Background task called', args);
};
import {AppRegistry} from 'react-native';

import { configure, startMonitoring, stopMonitoring} from "rn-android-ble-watcher";

import BackgroundTask from './BackgroundTask.js';

AppRegistry.registerHeadlessTask('MyBackgroundTask', () => BackgroundTask);

// ...
configure({
    notification: {
        channelId:'MyExampleApp',
        channelName: 'My Example App',
    },
});

// Starts monitoring for device with address FF:FF:FF:FF:FF:FF and runs MyBackgroundTask
startMonitoring('FF:FF:FF:FF:FF:FF', 'MyBackgroundTask');

// stopMonitoring();

About

React Native Android BLE Watcher

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published