Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Zfinix committed Dec 12, 2022
1 parent bd3873b commit 8a7d385
Show file tree
Hide file tree
Showing 11 changed files with 89 additions and 100 deletions.
Binary file added 1.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified 1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 2.0.7
* Breaking changes for Multi sim supoer
* Syntax clean up

## 2.0.6
* Add support for Flutter 2.17.0 (Stable channel)
* Syntax clean up
Expand Down
150 changes: 77 additions & 73 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,84 +8,88 @@ Carrier Info gets networkType, networkGeneration, mobileCountryCode, mobileCount

<p float="left">
<img src="https://github.com/Zfinix/carrier_info/blob/main/1.png?raw=true" width="200">
<img src="https://github.com/Zfinix/carrier_info/blob/main/1.jpeg?raw=true" width="200">
</p>

### allowsVOIP (iOS only)
### Fetching android carrier info

```dart
bool carrierInfo = await CarrierInfo.allowsVOIP; // Indicates if the carrier allows VoIP calls to be made on its network.
```

- If you configure a device for a carrier and then remove the SIM card, this property retains the Boolean value indicating the carrier’s policy regarding VoIP.
- Always return `true` on Android.

### carrierName

```dart
String carrierInfo = await CarrierInfo.carrierName; // The name of the user’s home cellular service provider.
```

- This string is provided by the carrier and formatted for presentation to the user. The value does not change if the user is roaming; it always represents the provider with whom the user has an account.
- If you configure a device for a carrier and then remove the SIM card, this property retains the name of the carrier.
- The value for this property is 'nil' if the device was never configured for a carrier.

### isoCountryCode

```dart
String carrierInfo = await CarrierInfo.isoCountryCode; // The ISO country code for the user’s cellular service provider.
```

- This property uses the ISO 3166-1 country code representation.
- The value for this property is 'nil' if any of the following apply:
- The device is in Airplane mode.
- There is no SIM card in the device.
- The device is outside of cellular service range.

### mobileCountryCode

```dart
String carrierInfo = await CarrierInfo.mobileCountryCode; //The mobile country code (MCC) for the user’s cellular service provider.
```

- MCCs are defined by ITU-T Recommendation E.212, “List of Mobile Country or Geographical Area Codes.”
- The value for this property is 'nil' if any of the following apply:
- There is no SIM card in the device.
- The device is outside of cellular service range.
- The value may be 'nil' on hardware prior to iPhone 4S when in Airplane mode.

### mobileNetworkCode

```dart
String carrierInfo = await CarrierInfo.mobileNetworkCode // The mobile network code (MNC) for the user’s cellular service provider.
```

- The value for this property is 'nil' if any of the following apply:
- There is no SIM card in the device.
- The device is outside of cellular service range.
- The value may be 'nil' on hardware prior to iPhone 4S when in Airplane mode.

### networkGeneration

```dart
String carrierInfo = await CarrierInfo.networkGeneration // 5G, 4G ... 2G
```

### radioType

```dart
String carrierInfo = await CarrierInfo.radioType // LTE, HSDPA, e.t.c
```

### cid (Android only)

```dart
int carrierInfo = await CarrierInfo.cid // Cell Id, only on android for now, returns null on iPhone
```

### lac (Android only)
Docs: https://developer.android.com/reference/android/telephony/TelephonyManager#getNetworkCountryIso(), https://developer.android.com/reference/android/telephony/SubscriptionManager

```dart
int carrierInfo = await CarrierInfo.lac // Local Area Code, only on android for now, returns null on iPhone
AndroidCarrierData? carrierInfo = await CarrierInfo.getAndroidInfo();
returns {
"isVoiceCapable": true,
"isDataEnabled": true,
"subscriptionsInfo": [
{
"mobileCountryCode": "310",
"isOpportunistic": false,
"mobileNetworkCode": "260",
"displayName": "T-Mobile",
"isNetworkRoaming": false,
"simSlotIndex": 0,
"phoneNumber": "+15551234567",
"countryIso": "us",
"subscriptionType": 0,
"cardId": 0,
"isEmbedded": false,
"carrierId": 1,
"subscriptionId": 1,
"simSerialNo": "",
"dataRoaming": 0
}
],
"isDataCapable": true,
"isMultiSimSupported": "MULTISIM_NOT_SUPPORTED_BY_HARDWARE",
"isSmsCapable": true,
"telephonyInfo": [
{
"networkCountryIso": "us",
"mobileCountryCode": "310",
"mobileNetworkCode": "260",
"displayName": "T-Mobile",
"simState": "SIM_STATE_READY",
"isoCountryCode": "us",
"cellId": {
"cid": 47108,
"lac": 8514
},
"phoneNumber": "+15551234567",
"carrierName": "T-Mobile",
"subscriptionId": 1,
"networkGeneration": "4G",
"radioType": "LTE",
"networkOperatorName": "T-Mobile"
}
]
};
IosCarrierData? carrierInfo = await CarrierInfo.getIosInfo();
returns {
"carrierData": [
{
"mobileNetworkCode": null,
"carrierAllowsVOIP": true,
"mobileCountryCode": null,
"carrierName": "glo",
"isoCountryCode": null
},
{
"mobileNetworkCode": "20",
"isoCountryCode": "ng",
"carrierAllowsVOIP": true,
"carrierName": "Airtel",
"mobileCountryCode": "621"
}
],
"supportsEmbeddedSIM": false,
"carrierRadioAccessTechnologyTypeList": [
"LTE"
]
}
};
```

## ✨ Contribution
Expand Down
19 changes: 0 additions & 19 deletions carrier_info.iml

This file was deleted.

Binary file removed example/flutter_01.png
Binary file not shown.
8 changes: 5 additions & 3 deletions example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,11 @@ class MyApp extends StatefulWidget {
}

class _MyAppState extends State<MyApp> {
dynamic iosInfo;
IosCarrierData? _iosInfo;
IosCarrierData? get iosInfo => _iosInfo;
set iosInfo(IosCarrierData? iosInfo) {
setState(() => _iosInfo = iosInfo);
}

AndroidCarrierData? _androidInfo;
AndroidCarrierData? get androidInfo => _androidInfo;
Expand All @@ -44,7 +48,6 @@ class _MyAppState extends State<MyApp> {
try {
if (Platform.isAndroid) androidInfo = await CarrierInfo.getAndroidInfo();
if (Platform.isIOS) iosInfo = await CarrierInfo.getIosInfo();
setState(() {});
} catch (e) {
print(e.toString());
}
Expand All @@ -56,7 +59,6 @@ class _MyAppState extends State<MyApp> {

@override
Widget build(BuildContext context) {
debugPrint(jsonPretty(iosInfo));
return Material(
color: Colors.transparent,
child: CupertinoApp(
Expand Down
2 changes: 1 addition & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ packages:
path: ".."
relative: true
source: path
version: "2.0.6"
version: "2.0.7"
characters:
dependency: transitive
description:
Expand Down
2 changes: 0 additions & 2 deletions ios/Classes/Carrier.swift
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ final public class Carrier {

deinit {
NotificationCenter.default.removeObserver(changeObserver!)
print(#function)
}

public weak var delegate: CarrierDelegate?
Expand Down Expand Up @@ -115,7 +114,6 @@ final public class Carrier {
"mobileCountryCode": carr.mobileCountryCode,
"mobileNetworkCode": carr.mobileNetworkCode,
"carrierAllowsVOIP": carr.allowsVOIP,

])

}
Expand Down
2 changes: 1 addition & 1 deletion lib/carrier_info.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
library carrier_info;

export 'src/src.dart';
export 'src/src.dart';
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: carrier_info
description: Carrier Info gets networkType, networkGeneration, mobileCountryCode, mobileCountryCode, e.t.c from both android and ios devices
version: 2.0.6
version: 2.0.7
homepage: https://github.com/Zfinix/carrier_info

environment:
Expand Down

0 comments on commit 8a7d385

Please sign in to comment.