flutter_beacon
flutter_beacon copied to clipboard
BUG: FlutterJNI was detached from native C++
Everything seems to work on both platforms except for android when app is stopped. I will be monitoring and scanning for iBeacons with the app open and see prints successfully, however once I completely close the app I get the following print error
W/FlutterJNI(30164): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: flutter_beacon_event. Response ID: 0
W/FlutterJNI(13542): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: flutter_beacon_event_monitoring. Response ID: 0
then once I bring the app back it works again. Has anyone else experienced this?
EDIT: my guess is that when the app is closed the activity gets detached and therefore, the channels are being closed (FlutterBeaconPlugin.java)
private void teardownChannels() {
if (activityPluginBinding != null) {
activityPluginBinding.removeActivityResultListener(this);
activityPluginBinding.removeRequestPermissionsResultListener(this);
}
platform = null;
beaconBroadcast = null;
channel.setMethodCallHandler(null);
eventChannel.setStreamHandler(null);
eventChannelMonitoring.setStreamHandler(null);
eventChannelBluetoothState.setStreamHandler(null);
eventChannelAuthorizationStatus.setStreamHandler(null);
channel = null;
eventChannel = null;
eventChannelMonitoring = null;
eventChannelBluetoothState = null;
eventChannelAuthorizationStatus = null;
activityPluginBinding = null;
}
is there a downside to keeping the eventChannel
and eventChannelMonitoring
open so that iBeacon events can happen even when the app is killed?
Hi @evanblasband
Those message are regarding Flutter engine https://github.com/flutter/flutter/issues/28651. With the latest release of Flutter, I don't seem to see it again. Is this issue persists?
Same problem for me when the app is closed by back button on flutter beta if i use a physical device to work. It not happen on android emulator
Flutter 2.10.0-0.1.pre • channel beta • https://github.com/flutter/flutter.git Framework • revision 628f0e3f3a (8 days ago) • 2022-01-11 19:50:05 -0600 Engine • revision 63ca99584a Tools • Dart 2.16.0 (build 2.16.0-134.1.beta) • DevTools 2.9.2
W/FlutterJNI(13495): Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: flutter_beacon_event. Response ID: ...
@alann-maulana we are facing the same error, can you help? can I have your contact? you can search my name on Linkedin Natam Oliveira