beacons_plugin 1.0.2 copy "beacons_plugin: ^1.0.2" to clipboard
beacons_plugin: ^1.0.2 copied to clipboard

outdated

This plugin makes it easier to scan nearby iBeacons and range them in flutter app. Scaned beacons will provide proximity values.

beacons_plugin #

pub package

This plugin is developed to scan nearby iBeacons on both Android iOS. This library makes it easier to scan & range nearby BLE beacons and read their proximity values.

Android #

For Android change min SDK version:

defaultConfig {
  ...
  minSdkVersion 18
  ...
}

Install #

In your pubspec.yaml

dependencies:
  beacons_plugin: ^1.0.1
import 'dart:io' show Platform;
import 'package:flutter/services.dart';
import 'package:beacons_plugin/beacons_plugin.dart';

Ranging Beacons #

    static const MethodChannel methodChannel = const MethodChannel('beacons_plugin');
    
    static Future<String> addRegion(String identifier) async {
        final String result = await methodChannel.invokeMethod('addRegion', <String, dynamic>{'identifier': identifier});
        print(result);
        return result;
    }
    
    static Future<String> addRegionForIOS(String uuid, int major, int minor, String name) async {
        final String result = await methodChannel.invokeMethod('addRegionForIOS', <String, dynamic>{
          'uuid': uuid,
          'major': major,
          'minor': minor,
          'name': name
        });
        print(result);
        return result;
    }

    if (Platform.isAndroid) {
      await addRegion("Beacon1");
    } else if (Platform.isIOS) {
      await addRegionForIOS(
          "01022022-f88f-0000-00ae-9605fd9bb620", 1, 1, "BeaconName");
    }

Listen To Beacon Scan Results #

    static const eventChannel = EventChannel('beacons_plugin_stream');
    
    static listenToBeacons() async {
        eventChannel.receiveBroadcastStream().listen((dynamic event) {
          print('Received: $event');
        }, onError: (dynamic error) {
          print('Received error: ${error.message}');
        });
    }

Native Libraries #

Author #

Flutter Beacons plugin is developed by Umair Adil. You can email me at m.umair.adil@gmail.com for any queries.

64
likes
0
points
232
downloads

Publisher

verified publisherumairadil.com

Weekly Downloads

This plugin makes it easier to scan nearby iBeacons and range them in flutter app. Scaned beacons will provide proximity values.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter

More

Packages that depend on beacons_plugin