Using mobile_number package to detect multiple SIM card but only able to detect 1 sim card in few android and in few android not able to detect even 1 SIM card, and also need help with which sim is detected SIM1 or SIM2
@override
void onInit() {
dbtIdController.value.addListener(dbtFormValid);
if (Platform.isAndroid) {
MobileNumber.listenPhonePermission((isPermissionGranted) {
if (isPermissionGranted) {
initMobileNumberState();
}
});
initMobileNumberState();
}
super.onInit();
}
Future<void> initMobileNumberState() async {
if (!await MobileNumber.hasPhonePermission) {
await MobileNumber.requestPhonePermission;
return;
}
List<SimCard> simCards = [];
try {
(await MobileNumber.mobileNumber)!;
List<SimCard> simCardList = (await MobileNumber.getSimCards)!;
simCards = simCardList;
availableMobileNumbers.clear();
for (var simCard in simCards) {
String mobileNumber = simCard.number ?? 'N/A';
availableMobileNumbers.add(mobileNumber);
}
} on PlatformException catch (e) {
debugPrint('Failed to get SIM cards because of ${e.message}');
}
}
Been facing this issue and we need to implement a two way scenario for higher and lower android sdks to solve this in the long run
}