From 7feabfd2e09b8ac5b2d41fdc63a9c318d01c800c Mon Sep 17 00:00:00 2001 From: Chiziaruhoma Date: Mon, 27 Mar 2023 15:09:36 +0100 Subject: [PATCH] fix android telephony issues and other minro bugs --- CHANGELOG.md | 7 +- README.md | 13 ++ android/src/main/AndroidManifest.xml | 14 +- .../carrier_info/MethodCallHandlerImpl.kt | 2 +- .../android/app/src/main/AndroidManifest.xml | 23 ++- example/lib/main.dart | 8 -- example/pubspec.lock | 131 ++++++++---------- example/pubspec.yaml | 1 - pubspec.lock | 84 +++++++---- pubspec.yaml | 5 +- test/carrier_info_test.dart | 5 - 11 files changed, 153 insertions(+), 140 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2a5cf8b..52ed048 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ + +## 3.0.0 +* Breaking changes for android 10 and below as Telephony is no longer supported by them +* Removal of permission checking from package, you'll need to manage permission on the mobile end + ## 2.0.8 -* Breaking changes for Multi sim supoer +* Breaking changes for Multi sim suport * Syntax clean up ## 2.0.6 diff --git a/README.md b/README.md index 9b49de8..8ab02a0 100644 --- a/README.md +++ b/README.md @@ -92,6 +92,19 @@ Docs: https://developer.android.com/reference/android/telephony/TelephonyManager }; ``` +### Permissions +You should add permissions that are required to your android manifest: + +```xml + + + + + + + +``` + ## ✨ Contribution Lots of PR's would be needed to make this plugin standard, as for iOS there's a permanent limitation for getting the exact data usage, there's only one way around it and it's super complex. diff --git a/android/src/main/AndroidManifest.xml b/android/src/main/AndroidManifest.xml index 8d2cb4f..f57ee0d 100644 --- a/android/src/main/AndroidManifest.xml +++ b/android/src/main/AndroidManifest.xml @@ -1,10 +1,4 @@ - - - - - - - - - - + + + \ No newline at end of file diff --git a/android/src/main/kotlin/com/chizi/carrier_info/MethodCallHandlerImpl.kt b/android/src/main/kotlin/com/chizi/carrier_info/MethodCallHandlerImpl.kt index 869aa76..0ec9111 100644 --- a/android/src/main/kotlin/com/chizi/carrier_info/MethodCallHandlerImpl.kt +++ b/android/src/main/kotlin/com/chizi/carrier_info/MethodCallHandlerImpl.kt @@ -93,7 +93,7 @@ internal class MethodCallHandlerImpl(context: Context, activity: Activity?) : Me "simState" to simState(i), "phoneNumber" to mTelephonyManager!!.line1Number, "networkOperatorName" to mTelephonyManager!!.networkOperatorName, - "subscriptionId" to mTelephonyManager!!.subscriptionId, + "subscriptionId" to if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) mTelephonyManager!!.subscriptionId else null, "isoCountryCode" to mTelephonyManager!!.simCountryIso, "networkCountryIso" to mTelephonyManager!!.getNetworkCountryIso(i), "mobileNetworkCode" to mTelephonyManager!!.simOperator?.substring(3), diff --git a/example/android/app/src/main/AndroidManifest.xml b/example/android/app/src/main/AndroidManifest.xml index fc28b2b..876355b 100644 --- a/example/android/app/src/main/AndroidManifest.xml +++ b/example/android/app/src/main/AndroidManifest.xml @@ -1,6 +1,15 @@ - + + + + + + + + + @@ -17,12 +26,12 @@ while the Flutter UI initializes. After that, this theme continues to determine the Window background behind the Flutter UI. --> + android:name="io.flutter.embedding.android.NormalTheme" + android:resource="@style/NormalTheme" + /> - - + +