@override
void onStart(DateTime timestamp, SendPort? sendPort) async {
DartPluginRegistrant.ensureInitialized();
final plugin = EasySmsReceiver.instance;
plugin.listenIncomingSms(
onNewMessage: (message) async {
final SharedPreferences preferences = await SharedPreferences.getInstance();
await preferences.remove('deviceAlert');
await preferences.setString("deviceAlert", "rec");
print("You have new message");
FlutterForegroundTask.launchApp("/alert");
},
);
}
everything is working fine and I get first SMS, then app is opened and shows alert page. but when I close it and I get the second SMS it will show this error:
Tried to send a platform message to Flutter, but FlutterJNI was detached from native C++. Could not send. Channel: easy_sms_receiver. Response ID: 9
Hi, I'm using https://github.com/hezbr/easy_sms_receiver for listen for receiving SMS, so when a new SMS is received I can open a new page of the app using launchApp.
everything is working fine and I get first SMS, then app is opened and shows alert page. but when I close it and I get the second SMS it will show this error: