Flutter-Mobile-Number-Plugin
Flutter-Mobile-Number-Plugin copied to clipboard
Add support for Android >= 33
I used your library to get the phone number, but it doesn't work with eSIM. I tried replacing
subscriptionInfo.getNumber();
with
final int id = SubscriptionManager.getActiveDataSubscriptionId(); final String phoneNumber = subscriptionManager.getPhoneNumber(id);
and it worked. This method was added in API 33 to replace the deprecated getNumber()
doc: https://developer.android.com/reference/kotlin/android/telephony/SubscriptionManager#getphonenumber_1