beacon_broadcast 0.1.2

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • new50

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
});

Before advertising, you may want to check if your device supports transmitting as a beacon. You may do it using checkTransmissionSupported() method.

var transmissionSupportStatus = await beaconBroadcast.checkTransmissionSupported();
switch (transmissionSupportStatus) {
  case BeaconStatus.SUPPORTED:
    // You're good to go, you can advertise as a beacon
    break;
  case BeaconStatus.NOT_SUPPORTED_MIN_SDK:
    // Your Android system version is too low (min. is 21)
    break;
  case BeaconStatus.NOT_SUPPORTED_BLE:
    // Your device doesn't support BLE
    break;
  case BeaconStatus.NOT_SUPPORTED_CANNOT_GET_ADVERTISER:
    // Either your chipset or driver is incompatible
    break;
}

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:

  • [X] Adding option for checking for Android device support programmatically
  • [ ] Adding option to set layout and manufacturer for Android implementation
  • [ ] Handle turning on BLE before transmitting

0.1.2 #

Updates in the documentation

0.1.1 #

Adding method for checking if transmission is supported on the device.

0.1.0 #

First stable version of the app. No major changes

0.0.1 #

Initial version of the library. This version includes:

  • starting and stopping beacon advertising
  • setting beacon UUID, major id, minor id, transmission power and identifier

example/README.md

beacon_broadcast_example #

Demonstrates how to use the beacon_broadcast plugin.

Example #

To see the example, check example/lib/main.dart file

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  beacon_broadcast: ^0.1.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:beacon_broadcast/beacon_broadcast.dart';
  
Version Uploaded Documentation Archive
0.1.2 Mar 1, 2019 Go to the documentation of beacon_broadcast 0.1.2 Download beacon_broadcast 0.1.2 archive
0.1.1 Mar 1, 2019 Go to the documentation of beacon_broadcast 0.1.1 Download beacon_broadcast 0.1.1 archive
0.1.0 Feb 27, 2019 Go to the documentation of beacon_broadcast 0.1.0 Download beacon_broadcast 0.1.0 archive
0.0.1 Feb 27, 2019 Go to the documentation of beacon_broadcast 0.0.1 Download beacon_broadcast 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
0
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
50
Learn more about scoring.

We analyzed this package on Mar 6, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.3.3

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test
test ^1.3.0