Open roip890 opened 2 years ago
telephony.listenIncomingSms this method works fine in debug mode but not worked in release mode?
(Solved) This below solution works with (another_telephony & telephony_fix as well.)
Few OS gives default Auto Start enabled to the app and few don't. MIUI does not give auto start enabled to the app as default config. Need to add auto start package (flutter_autostart: ^0.0.2) - Check if auto start is enabled or not, and if auto start is not enabled than open setting for the enduser using this package.
final _flutterAutostartPlugin = FlutterAutostart();
@override
void initState() {
checkIsAutoStartEnabled();
super.initState();
}
Future<void> checkIsAutoStartEnabled() async {
String isAutoStartEnabled;
try {
isAutoStartEnabled = await _flutterAutostartPlugin.checkIsAutoStartEnabled() == true ? "Yes" : "No";
print("isAutoStartEnabled: $isAutoStartEnabled");
} on PlatformException {
isAutoStartEnabled = 'Failed to check isAutoStartEnabled.';
}
if (!mounted) return;
}
Future<void> openAutoStartPermissionSettings() async {
String autoStartPermission;
try {
autoStartPermission =
await _flutterAutostartPlugin.showAutoStartPermissionSettings() ?? 'Unknown autoStartPermission';
} on PlatformException {
autoStartPermission = 'Failed to show autoStartPermission.';
}
if (!mounted) return;
}
I don't know what it is happening.. but with my phone everything worked perfectly (Samsung Galaxy Note 20 Ultra). And when I tried it on Redmi 9 phone and Xiaomi MI 10 It didn't worked. I couldn't listen to messages at all. And the really weird part is that I even couldn't listen to messages on my phone (the Galaxy Note 20 Ultra) that comes from the Redmi and the Xiaomi phones..