beacons_plugin 1.0.5 copy "beacons_plugin: ^1.0.5" to clipboard
beacons_plugin: ^1.0.5 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.5
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('com.umair.beacons_plugin_example/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('com.umair.beacons_plugin_example/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.

62
likes
0
pub points
84%
popularity

Publisher

verified publisherumairadil.com

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