beacon_broadcast 0.1.0 copy "beacon_broadcast: ^0.1.0" to clipboard
beacon_broadcast: ^0.1.0 copied to clipboard

outdated

A Flutter plugin for turning your device into a beacon. Plugin uses AltBeacon library for Android and CoreLocation for iOS.

Beacon Broadcast plugin for Flutter #

A Flutter plugin for turning your device into a beacon.

Usage #

To use this plugin, add beacon_broadcast as a dependency in your pubspec.yaml file and import:

import 'package:beacon_broadcast/beacon_broadcast.dart';

Now you can create BeaconBroadcast object and start using it:

BeaconBroadcast beaconBroadcast = BeaconBroadcast();

To start advertising, just set parameters and call start()

beaconBroadcast
    .setUUID('39ED98FF-2900-441A-802F-9C398FC199D2')
    .setMajorId(1)
    .setMinorId(100)
    .setTransmissionPower(-59) //optional
    .setIdentifier("com.example.myDeviceRegion") //iOS-only, optional
    .start();

You can check what's current state of your beacon:

var isAdvertising = beaconBroadcast.isAdvertising()

You can also register for changes in beacon advertising state:

beaconBroadcast.getAdvertisingStateChange().listen((isAdvertising) {
    // Now you know if beacon is advertising
});

If you want to stop advertising, just call stop():

beaconBroadcast.stop();

Android

Important note: For Android app, user needs to turn on Bluetooth on the device first.

Android beacon will advertise as AltBeacon manufactured by RadiusNetwork. In current library version it can't be changed.

iOS

For iOS, it's worth to mention that application needs to work in foreground. According to the CoreLocation documentation:

Important

After advertising your app as a beacon, your app must continue running in the foreground to broadcast the needed Bluetooth signals. If the user quits the app, the system stops advertising the device as a peripheral over Bluetooth.

iOS beacon will advertise as iBeacon.

About #

This plugin uses Android Beacon Library for Android and CoreLocation for iOS.

Todo #

There are still few things left to implement:

  • ❌ Adding option to set layout and manufacturer for Android implementation
  • ❌ Handle turning on BLE and granting location permission on Android
  • ❌ Adding option for checking for Android device support programmatically
41
likes
0
pub points
87%
popularity

Publisher

unverified uploader

A Flutter plugin for turning your device into a beacon. Plugin uses AltBeacon library for Android and CoreLocation for iOS.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on beacon_broadcast