Code Monkey home page Code Monkey logo

simple_beacons_flutter's Introduction

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 19
  ...
}

Change your Android Project's MainActivity class to following:

import com.umair.beacons_plugin.BeaconsPlugin
import io.flutter.embedding.android.FlutterActivity

class MainActivity : FlutterActivity(){

    override fun onPause() {
        super.onPause()

        //Start Background service to scan BLE devices
        BeaconsPlugin.startBackgroundService(this)
    }

    override fun onResume() {
        super.onResume()

        //Stop Background service, app is in foreground
        BeaconsPlugin.stopBackgroundService(this)
    }
}

That's it for Android.

iOS

In your AppDelegate.swift file change it to like this:

    
    import UIKit
    import Flutter
    import CoreLocation
    
    @UIApplicationMain
    @objc class AppDelegate: FlutterAppDelegate {
    
        let locationManager = CLLocationManager()
    
        override func application(
            _ application: UIApplication,
            didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
        ) -> Bool {
    
            locationManager.requestAlwaysAuthorization()
            GeneratedPluginRegistrant.register(with: self)
    
            return super.application(application, didFinishLaunchingWithOptions: launchOptions)
        }
    }

In your Info.plist file add following lines:

    <dict>
      <key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
    	<string>App needs location permissions to scan nearby beacons.</string>
    	<key>NSLocationWhenInUseUsageDescription</key>
    	<string>App needs location permissions to scan nearby beacons.</string>
    	<key>NSLocationAlwaysUsageDescription</key>
    	<string>App needs location permissions to scan nearby beacons.</string>
    </dict>

Install

In your pubspec.yaml

dependencies:
  beacons_plugin: [LATEST_VERSION]
import 'dart:async';
import 'dart:io' show Platform;
import 'package:flutter/services.dart';
import 'package:beacons_plugin/beacons_plugin.dart';

Ranging Beacons & Setting Up

    // if you need to monitor also major and minor use the original version and not this fork
    BeaconsPlugin.addRegion("myBeacon", "01022022-f88f-0000-00ae-9605fd9bb620")
        .then((result) {
          print(result);
        });
    
    //Send 'true' to run in background [OPTIONAL]
    await BeaconsPlugin.runInBackground(true);
    
    //IMPORTANT: Start monitoring once scanner is setup & ready (only for Android)
    if (Platform.isAndroid) {
      BeaconsPlugin.channel.setMethodCallHandler((call) async {
        if (call.method == 'scannerReady') {
          await BeaconsPlugin.startMonitoring();
        }
      });
    } else if (Platform.isIOS) {
      await BeaconsPlugin.startMonitoring();
    }
    

Listen To Beacon Scan Results as Stream

    
    final StreamController<String> beaconEventsController = StreamController<String>.broadcast();
    BeaconsPlugin.listenToBeacons(beaconEventsController);
    
    beaconEventsController.stream.listen(
        (data) {
          if (data.isNotEmpty) {
            setState(() {
              _beaconResult = data;
            });
            print("Beacons DataReceived: " + data);
          }
        },
        onDone: () {},
        onError: (error) {
          print("Error: $error");
        });

Stop Listening to Beacons

     await BeaconsPlugin.stopMonitoring();

Run in Background

    //Send 'true' to run in background
     await BeaconsPlugin.runInBackground(true);

Clear Regions

    await BeaconsPlugin.clearRegions();

Add custom beacons layout (AltBeacon)

    BeaconsPlugin.addBeaconLayoutForAndroid(
            "m:2-3=beac,i:4-19,i:20-21,i:22-23,p:24-24,d:25-25");

Add custom Foreground scan periods (AltBeacon)

    BeaconsPlugin.setForegroundScanPeriodForAndroid(
            foregroundScanPeriod: 2200, foregroundBetweenScanPeriod: 10);

Add custom Background scan periods (AltBeacon)

    BeaconsPlugin.setBackgroundScanPeriodForAndroid(
            backgroundScanPeriod: 2200, backgroundBetweenScanPeriod: 10);

Set the level of debug messages

    //Valid values: 0 = no messages, 1 = errors, 2 = all messages
    await BeaconsPlugin.setDebugLevel(int value);

Set Prominent Disclosure message (Android 10)

See: Link

    if (Platform.isAndroid) {
    
      //Prominent disclosure
      await BeaconsPlugin.setDisclosureDialogMessage(
          title: "Need Location Permission",
          message: "This app collects location data to work with beacons.");

      //Only in case, you want the dialog to be shown again. By Default, dialog will never be shown if permissions are granted.
      await BeaconsPlugin.clearDisclosureDialogShowFlag(false);
    }

    BeaconsPlugin.channel.setMethodCallHandler((call) async {
        if (call.method == 'isPermissionDialogShown') {
          //Do something here
        }
    });

Scan Results

Data Android iOS
name Yes Yes
uuid Yes Yes
major Yes Yes
minor Yes Yes
distance Yes Yes
proximity Yes Yes
rssi Yes Yes
macAddress Yes No
txPower Yes No

Native Libraries

Author

Flutter Beacons plugin is developed by Umair Adil. You can email me at [email protected] for any queries.

Support

Buy a coffe to Umair Adil, creator of this plugin.

Buy me a coffee

simple_beacons_flutter's People

Contributors

dariocavada avatar gazialankus avatar hucancode avatar linhadiretalipe avatar rishabnayak avatar umair13adil avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

simple_beacons_flutter's Issues

beacons updates

This is not an issue but a doubt...

i have tried the plugin and i can connect to several beacons (I add them to an array to show then in a list).

I have configured the beacons with an advertising interval of 100ms. And the list shows the beacons, uuid, minor, mayor, proximity, and so on...

But the refresh of the distance and proximity updates over a long time, i want to use this plugin so the users, when are in an inmediate proximity shows a local push notification.

But by the time that the beacons replies with and inmediate proximity, the walking user can be 10 meters away from the beacon...

Can this be done? I have tried to increase the advertising interval, but even it i increase it to several seconds ( 1,2 or 3), the proximity and distance does not show the right one ( i have to stop for several seconds to get the right one)

Thank you in advance.

Deactivate Permission Request

I am developing an app, that uses an introduction screen for the "prominent disclosure" needed for the background location permission on android. Now, every time when the app is newly installed on my device, a permission prompt pops up, even when the beacons-process has not been started.

It would be great to tell plugin to not ask for the permission itself. Would this be possible?

Bug in stop and start scanning. multiple time beacons detected

Hi,
For each time I stop and start scanning again, the number of beacons that are detected, increases as unusual.
I think maybe listener of steam, remaining and beacons capture multiple time.
Also, in the first time of running the app, after getting the permission of location, the detection not working and we should be stopped and start it. I just run the example app.

iOS allow monitoring beacon using just UUID

As for android it would be useful to filter the beacons only with uuid and not necessarily having to pass minor, major, name. I checked the code, but didn't find this capability.

Instead of this:

      BeaconsPlugin.addRegionForIOS(
              "01022022-f88f-0000-00ae-9605fd9bb620", 1, 1, "BeaconName")
          .then((result) {
        print(result);
      });

Something like:

      BeaconsPlugin.addRegionForIOS(
              "01022022-f88f-0000-00ae-9605fd9bb620", null, null, null)
          .then((result) {
        print(result);
      });

Or just:

      BeaconsPlugin.addRegionForIOS(
              "01022022-f88f-0000-00ae-9605fd9bb620")
          .then((result) {
        print(result);
      });

Thank you.

Feature request : Support for raw data or payload data

I have a number of IOT hardware sensors which provide an iBeacon interface and also expose the data that they contain - temperature and humidity - in a byte array. This is shown in the example below as RawData in the BLE Scanner app. Not sure how they have done this.

I've tried all the Flutter libraries I could find for Bluetooth/BLE and none of them seem to have a method to read this raw data. When using Bluetooth libraries in embedded micro controllers the Bluetooth libraries tend to have a method to get the payload or rawdata. This can then be decoded to extract the data that the manufacturer has encoded in the byte array.

Screenshot_20201102-103052_BLE Scanner
Screenshot_20201102-103209_BLE Scanner

Is it possible to add such a feature to this package?

Thank you.

Build Failed

Could not build your example for iOS.

`Launching lib/main.dart on iPhone 11 Pro Max in debug mode...
Running pod install... 1.7s
Running Xcode build...
Xcode build done. 6.5s
Failed to build iOS app
Error output from Xcode build:

** BUILD FAILED **

Xcode's output:

:1:9: note: in file included from :1:
#import "Headers/beacons_plugin-umbrella.h"
^
/Users/mrobinson/AndroidStudioProjects/shooter_flutter/ios/Pods/Target Support Files/beacons_plugin/beacons_plugin-umbrella.h:14:9: note: in file included from /Users/mrobinson/AndroidStudioProjects/shooter_flutter/ios/Pods/Target Support Files/beacons_plugin/beacons_plugin-umbrella.h:14:
#import "Runner-Bridging-Header.h"
^
/Users/mrobinson/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.6/ios/Classes/Runner-Bridging-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file not found
#import "GeneratedPluginRegistrant.h"
^
:0: error: could not build Objective-C module 'beacons_plugin'
:1:9: note: in file included from :1:
#import "Headers/beacons_plugin-umbrella.h"
^
/Users/mrobinson/AndroidStudioProjects/shooter_flutter/ios/Pods/Target Support Files/beacons_plugin/beacons_plugin-umbrella.h:14:9: note: in file included from /Users/mrobinson/AndroidStudioProjects/shooter_flutter/ios/Pods/Target Support Files/beacons_plugin/beacons_plugin-umbrella.h:14:
#import "Runner-Bridging-Header.h"
^
/Users/mrobinson/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.6/ios/Classes/Runner-Bridging-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file not found
#import "GeneratedPluginRegistrant.h"
^
:0: error: could not build Objective-C module 'beacons_plugin'
:1:9: note: in file included from :1:
#import "Headers/beacons_plugin-umbrella.h"
^
/Users/mrobinson/AndroidStudioProjects/shooter_flutter/ios/Pods/Target Support Files/beacons_plugin/beacons_plugin-umbrella.h:14:9: note: in file included from /Users/mrobinson/AndroidStudioProjects/shooter_flutter/ios/Pods/Target Support Files/beacons_plugin/beacons_plugin-umbrella.h:14:
#import "Runner-Bridging-Header.h"
^
/Users/mrobinson/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.6/ios/Classes/Runner-Bridging-Header.h:1:9: error: 'GeneratedPluginRegistrant.h' file not found
#import "GeneratedPluginRegistrant.h"
^
:0: error: could not build Objective-C module 'beacons_plugin'
note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description

Could not build the application for the simulator.
Error launching application on iPhone 11 Pro Max.`

`mrobinson@development lib % flutter doctor -v
[✓] Flutter (Channel beta, v1.17.0, on Mac OS X 10.15.4 19E287, locale en-US)
• Flutter version 1.17.0 at /Users/mrobinson/flutter
• Framework revision d3ed9ec945 (2 weeks ago), 2020-04-06 14:07:34 -0700
• Engine revision c9506cb8e9
• Dart version 2.8.0 (build 2.8.0-dev.18.0 eea9717938)

[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.2)
• Android SDK at /Users/mrobinson/Library/Android/sdk
• Platform android-29, build-tools 29.0.2
• ANDROID_HOME = /Users/mrobinson/Library/Android/sdk
• ANDROID_SDK_ROOT = /Users/mrobinson/Library/Android/sdk
• Java binary at: /Users/mrobinson/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6308749/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)
• All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 11.4, Build version 11E146
• CocoaPods version 1.8.3

[✓] Android Studio (version 3.6)
• Android Studio at /Users/mrobinson/Library/Application Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/192.6308749/Android
Studio.app/Contents
• Flutter plugin version 44.0.2
• Dart plugin version 192.7761
• Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b4-5784211)

[✓] IntelliJ IDEA Ultimate Edition (version 2020.1)
• IntelliJ at /Users/mrobinson/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
• Flutter plugin version 45.1.3
• Dart plugin version 201.6668.156

[✓] Connected device (1 available)
• iPhone 11 Pro Max • 71E1A5E8-1515-49B4-941E-F3C64455E234 • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-4 (simulator)

• No issues found!
mrobinson@development lib %
`

Random Mac Address

Hi!

I have a quick question. The mac address which is transmitted does not equal the device mac address and I assume it may be because of Android limiting this itself.

However, I somehow hope that I'm wrong... How is the mac address assigned?
I'm creating an app which scans for other phones using the same app (each phone is a beacon and each phone scans for other beacons). Do I have any opportunity to get a common mac address for 1 device (doesn't matter if original or fake. It just needs to be the same).

Thanks in advance! Best regards!
Lea

Not working on ios

@umair13adil Thanks a lot for this plugin!
This plugin is working on android, but for some reasons it's not scanning on iOS I'm using the example app with a little change (I created a Beacon model class)
the version I'm using : beacons_plugin: ^1.0.17
AppDelegate.swift

import UIKit
import Flutter
import CoreLocation

@UIApplicationMain
@objc class AppDelegate: FlutterAppDelegate {

    let locationManager = CLLocationManager()

    override func application(
        _ application: UIApplication,
        didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?
    ) -> Bool {

        locationManager.requestAlwaysAuthorization()
        GeneratedPluginRegistrant.register(with: self)

        return super.application(application, didFinishLaunchingWithOptions: launchOptions)
    }
}

the debug log

flutter: isRunning false
flutter: beacons_plugin: Region Added.
flutter: beacons_plugin: Region Added.
flutter: beacons_plugin: App will run in background? true
flutter: beacons_plugin: Started scanning Beacons.
flutter:  isRunning true

flutter doctor -v

[✓] Flutter (Channel stable, 1.22.1, on Mac OS X 10.15.3 19D76, locale en-MA)
    • Flutter version 1.22.1 at /Users/utilisateurq/development/flutter
    • Framework revision f30b7f4db9 (4 weeks ago), 2020-10-08 10:06:30 -0700
    • Engine revision 75bef9f6c8
    • Dart version 2.10.1

 
[!] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at /Users/utilisateurq/Library/Android/sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: /Applications/Android Studio.app/Contents/jre/jdk/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)
    ! Some Android licenses not accepted.  To resolve this, run: flutter doctor --android-licenses

[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Xcode 11.6, Build version 11E708
    • CocoaPods version 1.10.0

[✓] Android Studio (version 4.0)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin version 48.1.2
    • Dart plugin version 193.7361
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6222593)

[✓] VS Code (version 1.48.0)
    • VS Code at /Users/utilisateurq/Applications/Visual Studio Code.app/Contents
    • Flutter extension version 3.14.1

[✓] Connected device (2 available)
    • iPhone (mobile)            • a2f032ec0e5b522be1861894f38cad48003ae2e3 • ios • iOS 12.4.5
    • iPhone 11 Pro Max (mobile) • 98648157-1169-425A-8B56-6B0AADF39480     • ios • com.apple.CoreSimulator.SimRuntime.iOS-13-6
      (simulator)

Why i keep see the logs?

Hey, i'm using this plugin in my application. I started the monitoring thenk i stopped it but i keep see this logs in my console screen. What does it mean this logs. Did i wrong process?

I/BluetoothAdapter(25493): STATE_ON
D/BluetoothLeScanner(25493): Stop Scan with callback
I/BluetoothAdapter(25493): STATE_ON
D/BluetoothLeScanner(25493): Start Scan with callback
D/BluetoothLeScanner(25493): onScannerRegistered() - status=0 scannerId=7 mScannerId=0

version 1.0.15 - breaking changes

Please add some sort of alert for porting from 1.0.12 to 1.0.15, you have to remove some old code from the AndroidManifest and change the MainActivity.kt as shown in the documentation (Just to mention that if after upgrading the code did not compiles you have to modifify AndroidManifest and MainActivity.kt.)

App Rejection - iOS

If you don't use the background mode (scanning beacons), you must remove the following lines from Info.plist:

<key>UIBackgroundModes</key>
<string>location</string>

The apple team rejected my app because of this.

You could put this advice in your documentation.

Guideline 2.5.4 - Performance - Software Requirements

Your app declares support for location in the UIBackgroundModes key in your Info.plist file but does not have any features that require persistent location. Apps that declare support for location in the UIBackgroundModes key in your Info.plist file must have features that require persistent location.

Next Steps

To resolve this issue, please revise your app to include features that require the persistent use of real-time location updates while the app is in the background.

If your app does not require persistent real-time location updates, please remove the "location" setting from the UIBackgroundModes key. You may wish to use the significant-change location service or the region monitoring location service if persistent real-time location updates are not required for your app features.

Resources

For more information, please review the Starting the Significant-Change Location Service and Monitoring Geographical Regions.

iOS setMethodCallHandler not working

In the setMethodCallHandler method I don't get anything.
The following "IMPORTANT" statement is just for Android?

//IMPORTANT: Start monitoring once scanner is setup & ready
BeaconsPlugin.channel.setMethodCallHandler((call) async {

iOS Build Issue - Module not found

I am facing an issue during iOS app release build. The plugin works in the app as expected, but while archiving, the following error shows, "module beacons_plugin not found". How can I solve this?

Error run iOS

[VERBOSE-2:ui_dart_state.cc(157)] Unhandled Exception: MissingPluginException(No implementation found for method addRegion on channel beacons_plugin)
#0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:154:7)

#1 MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:329:12)
#2 BeaconsPlugin.addRegion (package:beacons_plugin/beacons_plugin.dart:24:41)
#3 BLE.scan (package:projcorona/bleScaning.dart:16:25)
#4 checkLocation. (package:projcorona/main.dart:416:11)
#5 _rootRun (dart:async/zone.dart:1180:38)
#6 _CustomZone.run (dart:async/zone.dart:1077:19)
#7 _CustomZone.runGuarded (dart:async/zone.dart:979:7)
#8 _CustomZone.bindCallbackGuarded. (dart:async/zone.dart:1019:23)
#9 _rootRun (dart:async/zone.dart:1184:13)
#10 _CustomZone.run (dart:async/zone.dart:1077:19)
#11 _CustomZone.bindCallback. (dart:async/zone.dart:1003:23)
#12 Timer._createTimer. (dart:async-patch/timer_patch.dart:23:15)
#13 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:398:19)
#14 _Timer._handleMessage (dart:isolate-patch/timer_impl.dart:429:5)
#15 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:168:12)

setMethodCallHandler never run?

I want scan beacon devices, wrote the code like example code but i only see 2. print in my console. I can't see 3. print and can't startMonitoring.

print("Beacons DataReceived: ");
    if (Platform.isAndroid) {
      print("Beacons DataReceived: ANDROID ");
      BeaconsPlugin.channel.setMethodCallHandler((call) async {
        print("Beacons DataReceived: " + call.method);
        if (call.method == 'scannerReady') {
    await BeaconsPlugin.startMonitoring();
        }
      });
    } else if (Platform.isIOS) {
      await BeaconsPlugin.startMonitoring();
    }

Background mode - iOS

Hi, when the app is in the background the library scans the beacons for about 15 seconds and then it stops. If I resume the app and put it in the background immediatly the library starts scanning for 15 seconds again and stops. How to increate the scanning to at least few minutes?
Here is the code I use to listen for new scanned beacons.

final StreamController<String> _beaconEventsController =
     StreamController<String>.broadcast();

   try {
     BeaconsPlugin.listenToBeacons(_beaconEventsController);

     await BeaconsPlugin.addRegion("Center", BEACON_UUID);

     _beaconEventsController.stream.listen(
         (data) async {
           await checkAllRequirements();
           if (data.isNotEmpty) {
             print('SCANNING');
             BeaconPayload beaconPayload = BeaconPayload.fromJson(data);
           }
         },
         onDone: () {},
         onError: (error) {
           print("Error: $error");
         });

     await BeaconsPlugin.runInBackground(true);

     await startMonitoring();
   } on PlatformException catch (e) {
     print(e.toString());
   }

Scanning for beacons not working

Currently having an issue implementing this plugin. Tried the readme and the example on git but it is not detecting the beacon.

I also noticed that in the example the code in onPause and onResume is the wrong way around and so changed this

Is there a way to use this where you do not have to enter the UUID? I basically need to be able to scan for all beacons and then print out the UUID and other details for each beacon detected. I thought the stream would give us this, but again - this doesn't seem to be working

So in my example im testing on an Android Samsung Galaxy S8 using a Minew D15N. For my implementation I will not know the UUID and need to detect all beacons within range. I shall update here if I can work it out - but would appreciate if anyone has had this issue and found a solution could get back to me.

Some issues || in Background and timing (after kill the app.)

Hello , first of all i would to thank you about this useful plug in , i was run the plug in into both IOS and Android and it works good , but after i killed the app the ble stop scaning and i got like this ::
MY LOGS ----->>

W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
I/chatty ( 8515): uid=10267(com.ensperity.projectcoronas) identical 1 line
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
D/BluetoothLeScanner( 8515): onScannerRegistered() - status=0 scannerId=9 mScannerId=0
E/ ( 8515): [ZeroHung]zrhung_get_config: Get config failed for wp[0x0008]
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
I/ScanHelper( 8515): Non-distinct packets detected in a single scan. Restarting scans unecessary.
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
W/FlutterJNI( 8515): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0
D/BeaconHelper( 8515): didExitRegion
I/ScanJob ( 8515): Using immediateScanJobId from manifest: 208352939
I/ScanJob ( 8515): Using periodicScanJobId from manifest: 208352940
W/JobInfo ( 8515): Requested interval +5m0s0ms for job 208352940 is too small; raising to +15m0s0ms
W/JobInfo ( 8515): Requested flex 0 for job 208352940 is too small; raising to +5m0s0ms
I/ScanJob ( 8515): Using periodicScanJobId from manifest: 208352940
I/ScanJob ( 8515): onStopJob called for immediate scan org.altbeacon.beacon.service.ScanJob@1ba2fba
I/CycledLeScanner( 8515): Using Android O scanner
I/ScanJob ( 8515): Using immediateScanJobId from manifest: 208352939
I/ScanJob ( 8515): Running immediate scan job: instance is org.altbeacon.beacon.service.ScanJob@ff8b15d

-------------------------------------------------------------------------------------------->>>
THE REASON OF MY APP >>>
i only need to know if i was connect to the beacon device every 1 min i need to scan if it around or not in foreground and in background (after kill the app) , it this plug-in will help us or i miss understand the concept of it.

--------------------------------------------------------------------------------------------->>
THE CONCLUSION ::(as questions) :

  1. how can i remove the stacked notification (Looking for nearby beacons)
  2. how i can make the plug-in scans every 1 min
    3 . is the plug-in works in background (after kill).
    .............................................................................................................................||.......................................................>>
    again i would to thanks you and i hope to fix that issues asap...-> 💯

version 1.0.15 - setMethodCallHandler is never been called

After upgrade to 1.0.15, the setMethodCallHandler never returns a value.

If you want to start beacon monitoring you have to manually call:

await BeaconsPlugin.startMonitoring;

If you try this code (taken from your example), the code prints out just STEP1 and not STEP2 and STEP3:

if (Platform.isAndroid) {
      print('****** STEP 1');
      BeaconsPlugin.channel.setMethodCallHandler((call) async {
        print('****** STEP 2');
        if (call.method == 'scannerReady') {
          print('****** STEP 3');
          await BeaconsPlugin.startMonitoring;
          setState(() {
            isRunning = true;
          });
        }
      });
    }

iOS Scanning for all beacons - not working

I have this plugin working great on Android. I do not have to specify any regions and the devices correctly report back all beacons in range. However on iOS i get nothing back.

All I want to do is be able to detect all beacons in range. Is anyone else having this difficulty on iOS?

Permissions are all set correctly and I can see it listening for beacons but, nothing is coming back - my Android device sitting next to the iOS device is constantly showing results.

version 1.16

I receive lots of messages from BluetoothScanner/BluertoothLEAdapter.
Is possible to remove them or messages are inside another package/plugin ?

D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothLeScanner(22631): onScannerRegistered() - status=0 scannerId=11 mScannerId=0
D/BluetoothAdapter(22631): isLeEnabled(): ON
E/CycledLeScannerForLollipop(22631): Scan failed: a BLE scan with the same settings is already started by the app
D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothLeScanner(22631): onScannerRegistered() - status=0 scannerId=11 mScannerId=0
D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothLeScanner(22631): onScannerRegistered() - status=0 scannerId=11 mScannerId=0
D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothLeScanner(22631): onScannerRegistered() - status=0 scannerId=11 mScannerId=0
D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothLeScanner(22631): onScannerRegistered() - status=0 scannerId=11 mScannerId=0
D/BluetoothAdapter(22631): isLeEnabled(): ON
D/BluetoothAdapter(22631): isLeEnabled(): ON

after terminated the app- iOS

after terminated the app the plugins stop scan the beacon why ?
I need scan the beacon after terminated please tell me how can do that
thank you so much for help

Attempt to register plugin but it was already registered.

Followed setup and install per https://pub.flutter-io.cn/packages/beacons_plugin

All I have done is the setup and I have not actually tried to use the package yet because it won't compile.

 flutter clean && flutter run
Deleting build...                                                  466ms
Deleting .dart_tool...                                               7ms
Deleting Generated.xcconfig...                                       2ms
Deleting flutter_export_environment.sh...                            1ms
Running "flutter pub get" in test_app...                         0.5s
Launching lib\main.dart on SM S920L in debug mode...
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done                        21.7s
√ Built build\app\outputs\flutter-apk\app-debug.apk.
Installing build\app\outputs\flutter-apk\app.apk...                31.6s
W/FlutterEnginePluginRegistry( 8949): Attempted to register plugin (io.flutter.embedding.engine.plugins.shim.ShimPluginRegistry$ShimRegistrarAggregate@3fdb8d1) but it was already registered with this FlutterEngine (io.flutter.embedding.engine.FlutterEngine@3fd8f36).

Unhandled Exception: MissingPluginException(No implementation found for method startMonitoring on channel beacons_plugin)

I've run into this situation: the plugin and my code ran perfectly in Android, but in iOS these errors happened:
(for easy reading I took the screenshot of VSCode debug console; the errors were the same while run it from Xcode)

image

It shows in the debug screenshot above exceptions took place while invoking method startMonitoring, but after I commented related codes it turned into other methods (e.g. stopMonitoring, addRegion, etc).

(BTW, the error messages may be as many as hundreds of lines - in the screenshot above, there were actually 381 lines of total error messages.)

My environment:

MacOS 10.15.7
iOS 12.4.8 (iPad) 13.3 (iPhone)
Android 8.0.0
Xcode 12.0.1 (12A7300)
VSCode 1.49.2
Android Studio 4.0.1 with all SDK after Android 5.1 Lollipop

Thanks for the help!

Does listenToBeacons say no beacons here?

I have a problem wiht listenToBeacons. That's my code:

beaconEventsController.stream.listen((data) async {
print(data);
print('DATA');
print(_beacons.length);
_beacons.clear();
_beacons.add(json.decode(data));
print(_beacons);
}, onDone: () {
print('DONEEEEE');
}, onError: (error) {
print("Error: $error");
});

this stream's listen doesnt send data when there are no beacon. I should get data even if there are no beacons. How can i do that?

Scanning not working on Android

I am trying to get this little prototype running, where i have my main app wrapped around a MultiProvider. When the app launches initState calls the function to start listening for the stream and print out the UUID when one is detected.

However this is not working at all. I am testing on a Galaxy S8 and sending out iBeacon broadcast, which i can see with other apps.

I have updated the Manifest and Main kotlin file to match the docs/examples but for the life of me I cannot get this working.

The aim here is that when the app launches, i need for it to be able to continue to scan whilst the app is running and also eventually using Navigator.of.. to move to other pages whilst the provider function called in initState keeps the scan going and reporting back to console whenever a new beacon is detected.

Here is my git repro for reference..

https://github.com/cloudbreakstudios/beacons_plugin_test

No beacons scanned

I'm running your example app on an iPhone. Runs fine but detects no beacons. I am using another app (BLE Hero) to insure that my beacon is actually transmitting (it is). I admit being very new to beacons but I have confirmed the UUID, major and minor regions and name of my beacon entered in the example code. There are no errors when running, just no results. Any suggestions?

The plugin stops working after resuming the app

Hello,

The plugin works very well in debug mod. But when I build an apk file and install it on my Android device, I got a problem. When I start the app for the first time everything is working very well but when I close the app and restart it, the plugin is not working and I cannot detect my beacons anymore. The only way to fix that is to clear the app's data in the android settings. I have the same problem with the example program of the plugin. How can I fix that ?

Asking for permissions

Hello,

First of all great package! I really love it!

However I noticed that the package does not ask for permissions (bluetooth or location), neither on iOS or Android. It is asking for location but even if you allow to use it does not actually turn it on and you have to manually turn the location and the bluetooth on.
Can this be implemented in the nearest release? Currently we have to handle this separately.

Best regards

Used the new version (1.18) for my project , but still rejected from Google Play

Used the new version for my project, but still rejected from Google Play:

I've compiled and I see the new dialog for permission, but I still have this from Google Play:

Prominent disclosure not found
Your app must display a prominent disclosure through a pop-up alert before your app’s location runtime permission. Based on our review, a prominent disclosure did not appear before the runtime permission.

Please add a prominent disclosure before the runtime permission.

Remember, your prominent disclosure must:
Appear before your app’s location runtime permission.
Include at least the following sentence, adapted to include all the relevant features requesting access to location in the background in the app that are readily visible to the user: “This app collects location data to enable ["feature"], ["feature"], & ["feature"] even when the app is closed or not in use.” If you extend permitted usage to ads, please also include: “This data is also used to provide ads/support advertising/support ads.”
Include any other details necessary to make it clear to the user how and why you are using location in the background. While additional content is permitted, it should not cause the required content to not be immediately visible.

Any idea to solve this ?

Maybe using a plugin like this:
https://pub.dev/packages/location_permissions

Features #

  • Check if permission to access location services is granted.
  • Request permission to access location services.
  • Open app settings so the user can allow permission to the location services.
  • Show a rationale for requesting permission to access location services (Android).

MainActivity.java

good evening, i have a problem with the package, i have mainactivity.java yours is in kotlin, what should i write in java to make it work? because it gives me errors. I'm so sorry but I'm new to flutter and dart. If I am successful, can I understand the exact operation? what types of beacons can i recognize?

App rejection - Android

My App was rejected with this message:

Prominent disclosure not found
Your app must display a prominent disclosure through a pop-up alert before your app’s location runtime permission. Based on our review, a prominent disclosure did not appear before the runtime permission.

The Beacon Plugin needs the PERMISSION_REQUEST_BACKGROUND_LOCATION and so:

Your app must display a prominent disclosure through a pop-up alert before your app’s location runtime permission. Based on our review, a prominent disclosure did not appear before the runtime permission.

Please add a prominent disclosure before the runtime permission.

Remember, your prominent disclosure must:

  • Appear before your app’s location runtime permission.

  • Include at least the following sentence, adapted to include all the relevant features requesting access to location in the background in the app that are readily visible to the user: “This app collects location data to enable ["feature"], ["feature"], & ["feature"] even when the app is closed or not in use.” If you extend permitted usage to ads, please also include: “This data is also used to provide ads/support advertising/support ads.”

  • Include any other details necessary to make it clear to the user how and why you are using location in the background. While additional content is permitted, it should not cause the required content to not be immediately visible.

I've seen some documentation on the altbeaconlibrary website:

https://altbeacon.github.io/android-beacon-library/requesting_permission.html

and also on google developer:

https://developer.android.com/training/permissions/requesting

Schermata 2020-11-03 alle 11 34 07

And other docs for permission.

https://support.google.com/googleplay/android-developer/answer/9799150
https://support.google.com/googleplay/android-developer/answer/9888170/
https://support.google.com/googleplay/android-developer/answer/9888170#location-permissions
https://support.google.com/googleplay/android-developer/answer/9799150

Do you have any solution for this problem ?

Executing tasks on background scan mode

Hello, firstly thanks so much for this awesome project.

I tried the package and it looks like working on background mode. But I want to execute some tasks for scanned device on background mode (like logging founded device or etc.)

How can I do that with this package? Is there any example for it?

I'm kind a new on Flutter world, sorry if that question kind a necessary

Thanks in advance

iOS doesn't work : bluetooth permission ?

Hello !

Thanks for the plugin. It's working fine on Android but I have a problem on iOS : it detect nothing since I pass in version 2.0.0. I think it has a link with a bluetooth permission. I add the lines in my info.plist but my phone doesn't ask me for bluetooth permission when I launch the app. Maybe there is something else ?

Here my info.plist :

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>CFBundleDevelopmentRegion</key>
	<string>$(DEVELOPMENT_LANGUAGE)</string>
	<key>CFBundleExecutable</key>
	<string>$(EXECUTABLE_NAME)</string>
	<key>CFBundleIdentifier</key>
	<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
	<key>CFBundleInfoDictionaryVersion</key>
	<string>6.0</string>
	<key>CFBundleName</key>
	<string>MiLo</string>
	<key>CFBundlePackageType</key>
	<string>APPL</string>
	<key>CFBundleShortVersionString</key>
	<string>$(FLUTTER_BUILD_NAME)</string>
	<key>CFBundleSignature</key>
	<string>????</string>
	<key>CFBundleVersion</key>
	<string>$(FLUTTER_BUILD_NUMBER)</string>
	<key>LSRequiresIPhoneOS</key>
	<true/>
	<key>NSLocationAlwaysAndWhenInUseUsageDescription</key>
	<string>App needs location permissions to scan nearby beacons.</string>
	<key>NSLocationWhenInUseUsageDescription</key>
	<string>App needs location permissions to scan nearby beacons.</string>
	<key>NSLocationAlwaysUsageDescription</key>
	<string>App needs location permissions to scan nearby beacons.</string>
	<key>NSAppTransportSecurity</key>
	<dict>
		<key>NSAllowsLocalNetworking</key>
		<true/>
	</dict>
	<key>UILaunchStoryboardName</key>
	<string>LaunchScreen</string>
	<key>UIMainStoryboardFile</key>
	<string>Main</string>
	<key>UISupportedInterfaceOrientations</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UISupportedInterfaceOrientations~ipad</key>
	<array>
		<string>UIInterfaceOrientationPortrait</string>
		<string>UIInterfaceOrientationPortraitUpsideDown</string>
		<string>UIInterfaceOrientationLandscapeLeft</string>
		<string>UIInterfaceOrientationLandscapeRight</string>
	</array>
	<key>UIViewControllerBasedStatusBarAppearance</key>
	<false/>
</dict>
</plist>

And here the code :

// All packages needed by the widget
import 'package:flutter/material.dart';
import 'dart:async';
import 'dart:io' show Platform;
import 'dart:convert';
import 'package:beacons_plugin/beacons_plugin.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import 'package:flutter_application_1/widgets/beacon_card.dart';

class BeaconDetection extends StatefulWidget {
  // Declaration of the variables needed by the widget 1/2
  final townId;
  final fontsizeValue;
  final languageId;
  final wordMessageBeforeScan;
  final wordButtonLaunchScan;
  final wordButtonStopScan;
  // Declaration of the variables needed by the widget 2/2
  BeaconDetection(
      {this.townId,
      this.fontsizeValue,
      this.languageId,
      this.wordMessageBeforeScan,
      this.wordButtonLaunchScan,
      this.wordButtonStopScan});
  @override
  _BeaconDetectionState createState() => _BeaconDetectionState();
}

class _BeaconDetectionState extends State<BeaconDetection> {
  bool isRunning = false;
  String _beaconUuid = '';
  double _beaconDistance = 0;
  String _beaconDetectedUuid = 'null';
  double _beaconDetectedDistance = 0;

  final StreamController<String> beaconEventsController =
      StreamController<String>.broadcast();
  @override
  void initState() {
    super.initState();
    initPlatformState();
  }

  @override
  void dispose() {
    beaconEventsController.close();
    super.dispose();
  }

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    if (Platform.isAndroid) {
      // Prominent disclosure
      await BeaconsPlugin.setDisclosureDialogMessage(
          title: "Need Location Permission",
          message: "This app collects location data to work with beacons.");
      // Only in case, you want the dialog to be shown again. By Default, dialog will never be shown if permissions are granted.
      // await BeaconsPlugin.clearDisclosureDialogShowFlag(false);
    }

    BeaconsPlugin.listenToBeacons(beaconEventsController);

    // Extraction of the name and the uuid of the beacons of the chosen city from the firebase
    FirebaseFirestore.instance
        .collection('towns/${widget.townId}/beacons')
        .snapshots()
        .listen((event) {
      event.docs.forEach((element) async {
        if (element['name'].isNotEmpty == true &&
            element['uuid'].isNotEmpty == true &&
            element['visibility'] == true) {
          await BeaconsPlugin.addRegion(element['name'], element['uuid']);
        }
      });
    });

    // When listening the data from beacons detected
    beaconEventsController.stream.listen(
        (data) {
          if (data.isNotEmpty) {
            setState(() {
              Map _beaconScanned = jsonDecode(data);
              _beaconUuid = _beaconScanned['uuid'];
              _beaconDistance = double.parse(_beaconScanned['distance']);
            });
            // print("Beacons DataReceived: " + data);
            FirebaseFirestore.instance
                .collection('towns/${widget.townId}/beacons')
                .where('uuid', isEqualTo: _beaconUuid)
                .snapshots()
                .listen((event) {
              event.docs.forEach((element) {
                if (_beaconUuid == element['uuid'] &&
                    element['visibility'] == true &&
                    _beaconDistance <= element['distance']) {
                  print('Beacon: $_beaconUuid | Distance: $_beaconDistance');
                  _beaconDetectedUuid = _beaconUuid;
                  _beaconDetectedDistance = _beaconDistance;
                }
              });
            });
          }
        },
        onDone: () {},
        onError: (error) {
          print("Error: $error");
        });
    await BeaconsPlugin.runInBackground(
        isRunning); // Send 'true' to run in background
    if (Platform.isAndroid) {
      BeaconsPlugin.channel.setMethodCallHandler((call) async {
        if (call.method == 'scannerReady') {
          await BeaconsPlugin.startMonitoring();
          setState(() {
            isRunning = true;
          });
        }
      });
    } else if (Platform.isIOS) {
      await BeaconsPlugin.startMonitoring();
      setState(() {
        isRunning = true;
      });
    }
    if (!mounted) return;
  }

  Widget build(BuildContext context) {
    return Column(
      children: [
        StreamBuilder<QuerySnapshot>(
            stream: FirebaseFirestore.instance
                .collection('towns/${widget.townId}/beacons')
                .where('uuid', isEqualTo: _beaconDetectedUuid)
                .snapshots(),
            builder: (ctx, snapshot) {
              if (snapshot.connectionState ==
                  ConnectionState.waiting) // Initialisation state
                return Container(
                  margin: const EdgeInsets.all(10),
                  height: 314, // Beacon card's size
                  child: Center(child: CircularProgressIndicator()),
                );
              if (_beaconDetectedUuid == 'null' &&
                  isRunning == false) // Before first scan State
                return Container(
                  margin: const EdgeInsets.all(10),
                  height: 314, // Beacon card's size
                  child: Center(child: Text(widget.wordMessageBeforeScan)),
                );
              if (_beaconDetectedUuid == 'null' &&
                  isRunning == true) // Launch first scan state
                return Container(
                  margin: const EdgeInsets.all(10),
                  height: 314, // Beacon card's size
                  child: Center(
                    child: CircularProgressIndicator(),
                  ),
                );
              final beacons = snapshot.data!.docs;
              return BeaconCard( // When the detection is done => Display the widget 'BeaconCard' with the following data
                title: beacons[0]['title'],
                monument: beacons[0]['monument'],
                image: beacons[0]['image'],
                duration: beacons[0]['duration'],
                distance: _beaconDetectedDistance,
                townId: widget.townId,
                uuid: beacons[0]['uuid'],
                fontsizeValue: widget.fontsizeValue,
                languageId: widget.languageId,
              );
            }),
        isRunning
            ? FloatingActionButton.extended( // If 'isRunning' is true => Display a button to stop the scan
                icon: Icon(Icons.bluetooth_disabled),
                label: Text(widget.wordButtonStopScan),
                backgroundColor: Colors.red,
                onPressed: () async {
                  await BeaconsPlugin.stopMonitoring();
                  setState(() {
                    isRunning = false;
                  });
                },
              )
            : FloatingActionButton.extended( // If 'isRunning' is false => Display a button to start the scan
                icon: Icon(Icons.bluetooth),
                label: Text(widget.wordButtonLaunchScan),
                backgroundColor: Theme.of(context).primaryColor,
                onPressed: () async {
                  initPlatformState();
                  await BeaconsPlugin.startMonitoring();
                  setState(() {
                    isRunning = true;
                    _beaconDetectedUuid = 'null';
                  });
                },
              ),
        SizedBox(
          height: 16,
        )
      ],
    );
  }
}

Thanks a lot and good day!

Android runInBackground error: Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++

I've set up beacons_plugin on Android and have set the run in background to true:
await BeaconsPlugin.runInBackground(true);

When I terminated the app, I didn't receive any info regarding beacons, but I got the following in logs:

W/FlutterJNI( 6303): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0

Can you please help me with this.
What should I do in order to get the results from the foreground Android service?

Unable to run (or build) the application on Android

Hi, I have the following error and it is impossible for me to run the app on Android. On iOS (where I have tested so far) it is working like a charm.

e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconHelper.kt: (155, 24): Type mismatch: inferred type is String? but String was expected

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':beacons_plugin:compileDebugKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 43s
The built failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Jetfier to solve the incompatibility.
Building plugin beacons_plugin...
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/AppUtils.kt: (14, 17): Unresolved reference: core
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/AppUtils.kt: (66, 24): Unresolved reference: NotificationCompat
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/AppUtils.kt: (73, 26): Unresolved reference: NotificationCompat
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconsPlugin.kt: (11, 17): Unresolved reference: core
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconsPlugin.kt: (12, 17): Unresolved reference: core
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconsPlugin.kt: (168, 20): Unresolved reference: ContextCompat
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconsPlugin.kt: (169, 21): Unresolved reference: ContextCompat
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconsPlugin.kt: (200, 29): Unresolved reference: ActivityCompat
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconsPlugin.kt: (204, 29): Unresolved reference: ActivityCompat
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconsPlugin.kt: (253, 24): Unresolved reference: ContextCompat
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconsPlugin.kt: (254, 25): Unresolved reference: ContextCompat
e: /Users/Home/Documents/SDKs/flutter/.pub-cache/hosted/pub.dartlang.org/beacons_plugin-1.0.19/android/src/main/kotlin/com/umair/beacons_plugin/BeaconsPlugin.kt: (263, 21): Unresolved reference: ContextCompat

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':compileReleaseKotlin'.
> Compilation error. See log for more details

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 59s

Exception: The plugin beacons_plugin could not be built due to the issue above.

Any advice will be highly appreciated!

Background activity crashes after 1min on Android

Hi again!

I have enabled the background activity, but after ~1min the monitoring process crashes, with the log saying

--->
D/BeaconHelper(14193): didExitRegion
I/ScanJob (14193): Using immediateScanJobId from manifest: 208352939
I/ScanJob (14193): Using periodicScanJobId from manifest: 208352940
W/JobInfo (14193): Specified interval for 208352940 is +5m0s0ms. Clamped to +15m0s0ms
W/JobInfo (14193): Specified flex for 208352940 is 0. Clamped to +5m0s0ms
W/JobInfo (14193): Specified interval for 208352940 is +5m0s0ms. Clamped to +15m0s0ms
W/JobInfo (14193): Specified flex for 208352940 is 0. Clamped to +5m0s0ms
I/ScanJob (14193): Using periodicScanJobId from manifest: 208352940
I/ScanJob (14193): onStopJob called for immediate scan org.altbeacon.beacon.service.ScanJob@1c46f94
D/BluetoothAdapter(14193): isLeEnabled(): ON
D/BluetoothAdapter(14193): isLeEnabled(): ON
D/BluetoothAdapter(14193): isLeEnabled(): ON
D/BluetoothLeScanner(14193): could not find callback wrapper
D/BluetoothAdapter(14193): isLeEnabled(): ON
I/CycledLeScanner(14193): Using Android O scanner
I/ScanJob (14193): Using immediateScanJobId from manifest: 208352939
I/ScanJob (14193): Running immediate scan job: instance is org.altbeacon.beacon.service.ScanJob@1750e8
I/ScanJob (14193): scanJob version 2.16.4 is starting up on the main process
W/ModelSpecificDistanceCalculator(14193): Cannot find match for this device. Using default
W/ModelSpecificDistanceCalculator(14193): Cannot find match for this device. Using default
D/BluetoothAdapter(14193): isLeEnabled(): ON
I/ScanJob (14193): Scan job running for 300000 millis
D/BluetoothAdapter(14193): isLeEnabled(): ON
D/BluetoothLeScanner(14193): onScannerRegistered() - status=0 scannerId=6 mScannerId=0
I/BluetoothLeScanner(14193): start scan is blocked
E/CycledLeScannerForLollipop(14193): Scan failed: app cannot be registered
<----

I've done some research and found some suggestions here: link
Unfortunately, none of the offered fixes helped.

I really appreciate your help! Thanks in advance and best regards,
Lea

[ANDROID] Not working after kill App

After killing the app the scans are interrupted and I get the message:

" Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: beacons_plugin_stream. Response ID: 0"

Are there any examples that work with the dead app?

Addregion for iOS

Hi,
Is there a way to control the user permission than pop up from app startup?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.