{"id":32305491,"url":"https://github.com/zfinix/carrier_info","last_synced_at":"2025-10-23T06:51:44.235Z","repository":{"id":41956335,"uuid":"319901263","full_name":"Zfinix/carrier_info","owner":"Zfinix","description":"📱 Carrier Info gets networkType, networkGeneration, mobileCountryCode, mobileCountryCode, e.t.c from both android and iOS devices. ","archived":false,"fork":false,"pushed_at":"2025-07-12T18:59:59.000Z","size":1026,"stargazers_count":36,"open_issues_count":2,"forks_count":60,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-10-23T06:51:37.329Z","etag":null,"topics":["android","flutter","ios"],"latest_commit_sha":null,"homepage":"","language":"Dart","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Zfinix.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2020-12-09T09:10:07.000Z","updated_at":"2025-07-12T19:00:03.000Z","dependencies_parsed_at":"2024-08-01T12:18:33.805Z","dependency_job_id":"e6878239-1656-4b14-921d-b8982d3badae","html_url":"https://github.com/Zfinix/carrier_info","commit_stats":{"total_commits":28,"total_committers":12,"mean_commits":"2.3333333333333335","dds":0.75,"last_synced_commit":"e310ba2809a9ca6e678864c8f79594a0469efe22"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Zfinix/carrier_info","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zfinix%2Fcarrier_info","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zfinix%2Fcarrier_info/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zfinix%2Fcarrier_info/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zfinix%2Fcarrier_info/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Zfinix","download_url":"https://codeload.github.com/Zfinix/carrier_info/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Zfinix%2Fcarrier_info/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":280577134,"owners_count":26354072,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-23T02:00:06.710Z","response_time":142,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","flutter","ios"],"created_at":"2025-10-23T06:51:34.292Z","updated_at":"2025-10-23T06:51:44.229Z","avatar_url":"https://github.com/Zfinix.png","language":"Dart","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 📱 Carrier Info\n\n[![pub package](https://img.shields.io/pub/v/carrier_info.svg?label=carrier_info\u0026color=blue)](https://pub.dev/packages/carrier_info)\n\n\u003e **⚠️ IMPORTANT iOS 16.0+ NOTICE**: Apple has deprecated `CTCarrier` starting with iOS 16.0. This means that most carrier-specific information (carrier name, country codes, network codes, etc.) will return `nil` or generic values on iOS 16.0 and later versions. This is an Apple platform limitation, not a plugin issue. See the [iOS Limitations](#ios-limitations) section for more details.\n\nCarrier Info gets networkType, networkGeneration, mobileCountryCode, mobileCountryCode, e.t.c from both android and ios devices. It's a port from this [js project](https://github.com/react-native-webrtc/react-native-carrier-info) and an improvement on the existing [flt_telephony_info package](https://pub.dev/packages/flt_telephony_info).\n\n## 📸 Screen Shots\n\n\u003cp float=\"left\"\u003e\n\u003cimg src=\"https://github.com/Zfinix/carrier_info/blob/main/1.png?raw=true\" width=\"200\"\u003e\n\u003cimg src=\"https://github.com/Zfinix/carrier_info/blob/main/1.jpeg?raw=true\" width=\"200\"\u003e\n\u003c/p\u003e\n\n### Fetching android carrier info\n\nDocs: https://developer.android.com/reference/android/telephony/TelephonyManager#getNetworkCountryIso(), https://developer.android.com/reference/android/telephony/SubscriptionManager\n\n```dart\n AndroidCarrierData? carrierInfo = await CarrierInfo.getAndroidInfo();\n returns  {\n   \"isVoiceCapable\": true,\n   \"isDataEnabled\": true,\n   \"subscriptionsInfo\": [\n     {\n       \"mobileCountryCode\": \"310\",\n       \"isOpportunistic\": false,\n       \"mobileNetworkCode\": \"260\",\n       \"displayName\": \"T-Mobile\",\n       \"isNetworkRoaming\": false,\n       \"simSlotIndex\": 0,\n       \"phoneNumber\": \"+15551234567\",\n       \"countryIso\": \"us\",\n       \"subscriptionType\": 0,\n       \"cardId\": 0,\n       \"isEmbedded\": false,\n       \"carrierId\": 1,\n       \"subscriptionId\": 1,\n       \"simSerialNo\": \"\",\n       \"dataRoaming\": 0\n     }\n   ],\n   \"isDataCapable\": true,\n   \"isMultiSimSupported\": \"MULTISIM_NOT_SUPPORTED_BY_HARDWARE\",\n   \"isSmsCapable\": true,\n   \"telephonyInfo\": [\n     {\n       \"networkCountryIso\": \"us\",\n       \"mobileCountryCode\": \"310\",\n       \"mobileNetworkCode\": \"260\",\n       \"displayName\": \"T-Mobile\",\n       \"simState\": \"SIM_STATE_READY\",\n       \"isoCountryCode\": \"us\",\n       \"cellId\": {\n         \"cid\": 47108,\n         \"lac\": 8514\n       },\n       \"phoneNumber\": \"+15551234567\",\n       \"carrierName\": \"T-Mobile\",\n       \"subscriptionId\": 1,\n       \"networkGeneration\": \"4G\",\n       \"radioType\": \"LTE\",\n       \"networkOperatorName\": \"T-Mobile\"\n     }\n   ]\n };\n```\n\n### Fetching iOS carrier info\n\n```dart\n IosCarrierData? carrierInfo = await CarrierInfo.getIosInfo();\n\n // iOS 15.x and earlier - Full carrier information available\n returns  {\n   \"carrierData\": [\n     {\n       \"mobileNetworkCode\": \"20\",\n       \"carrierAllowsVOIP\": true,\n       \"mobileCountryCode\": \"621\",\n       \"carrierName\": \"Airtel\",\n       \"isoCountryCode\": \"ng\"\n     }\n   ],\n   \"supportsEmbeddedSIM\": false,\n   \"carrierRadioAccessTechnologyTypeList\": [\"LTE\"],\n   \"isSIMInserted\": true,\n   \"subscriberInfo\": {\n     \"subscriberCount\": 1,\n     \"subscriberIdentifiers\": [\"subscriber_id_here\"],\n     \"carrierTokens\": [\"token_here\"]\n   },\n   \"cellularPlanInfo\": {\n     \"supportsEmbeddedSIM\": false\n   },\n   \"networkStatus\": {\n     \"hasCellularData\": true,\n     \"activeServices\": 1,\n     \"technologies\": [\"LTE\"]\n   },\n   \"_ios_version_info\": {\n     \"ios_version\": {...},\n     \"ctcarrier_deprecated\": false,\n     \"deprecation_notice\": \"CTCarrier functionality is available on this iOS version.\"\n   }\n }\n\n // iOS 16.0+ - Limited carrier information due to CTCarrier deprecation\n returns  {\n   \"carrierData\": [\n     {\n       \"mobileNetworkCode\": null,\n       \"carrierAllowsVOIP\": null,\n       \"mobileCountryCode\": null,\n       \"carrierName\": null,\n       \"isoCountryCode\": null,\n       \"_deprecated_notice\": \"CTCarrier is deprecated in iOS 16.0+. Carrier information is no longer available.\"\n     }\n   ],\n   \"supportsEmbeddedSIM\": false,\n   \"carrierRadioAccessTechnologyTypeList\": [\"LTE\"],\n   \"isSIMInserted\": true,\n   \"subscriberInfo\": {\n     \"subscriberCount\": 1,\n     \"subscriberIdentifiers\": [\"subscriber_id_here\"],\n     \"carrierTokens\": [\"token_here\"]\n   },\n   \"cellularPlanInfo\": {\n     \"supportsEmbeddedSIM\": true\n   },\n   \"networkStatus\": {\n     \"hasCellularData\": true,\n     \"activeServices\": 1,\n     \"technologies\": [\"LTE\"]\n   },\n   \"_ios_version_info\": {\n     \"ios_version\": {...},\n     \"ctcarrier_deprecated\": true,\n     \"deprecation_notice\": \"CTCarrier and CTSubscriber are deprecated in iOS 16.0+. Most carrier-specific information is no longer available for privacy and security reasons.\"\n   }\n }\n```\n\n## iOS Features\n\n### Available on All iOS Versions\n\n#### SIM Detection\n- **isSIMInserted**: Boolean indicating if a SIM card is inserted and active\n- **networkStatus**: Real-time network connectivity information\n- **carrierRadioAccessTechnologyTypeList**: Current radio technology (2G, 3G, 4G, 5G)\n\n#### Network Status\n```dart\n\"networkStatus\": {\n  \"hasCellularData\": true,        // Cellular data available\n  \"activeServices\": 1,            // Number of active cellular services\n  \"technologies\": [\"LTE\"]         // Current radio access technologies\n}\n```\n\n#### Subscriber Information (iOS 16.0+)\n```dart\n\"subscriberInfo\": {\n  \"subscriberCount\": 1,                           // Number of subscribers (dual SIM)\n  \"subscriberIdentifiers\": [\"subscriber_id\"],     // Subscriber identifiers\n  \"carrierTokens\": [\"token\"]                      // Carrier authentication tokens\n}\n```\n\n#### Cellular Plan Information\n```dart\n\"cellularPlanInfo\": {\n  \"supportsEmbeddedSIM\": true     // eSIM support detection\n}\n```\n\n### iOS Version Detection\n\nUse the `_ios_version_info` field to detect capabilities:\n\n```dart\nfinal iosInfo = await CarrierInfo.getIosInfo();\nfinal versionInfo = iosInfo?.toMap()['_ios_version_info'] as Map\u003cString, dynamic\u003e?;\nfinal isDeprecated = versionInfo?['ctcarrier_deprecated'] as bool? ?? false;\n\nif (isDeprecated) {\n  // Handle iOS 16.0+ limitations\n  print('SIM Inserted: ${iosInfo?.isSIMInserted}');\n  print('Network Status: ${iosInfo?.networkStatus?.hasCellularData}');\n  print('Radio Tech: ${iosInfo?.carrierRadioAccessTechnologyTypeList}');\n} else {\n  // Full carrier information available\n  print('Carrier: ${iosInfo?.carrierData?.first.carrierName}');\n  print('MCC: ${iosInfo?.carrierData?.first.mobileCountryCode}');\n}\n```\n\n## iOS Limitations\n\n### CTCarrier Deprecation (iOS 16.0+)\n\nStarting with iOS 16.0, Apple has deprecated the `CTCarrier` class and related APIs for privacy and security reasons. This affects the following information:\n\n**❌ No longer available on iOS 16.0+:**\n- Carrier name (`carrierName`)\n- Mobile country code (`mobileCountryCode`)\n- Mobile network code (`mobileNetworkCode`)\n- ISO country code (`isoCountryCode`)\n- VOIP allowance (`carrierAllowsVOIP`)\n\n**✅ Still available on iOS 16.0+:**\n- SIM insertion detection (`isSIMInserted`)\n- Radio access technology types (`carrierRadioAccessTechnologyTypeList`)\n- Network status (`networkStatus`)\n- Subscriber information (`subscriberInfo`)\n- Cellular plan information (`cellularPlanInfo`)\n\n### Recommendations\n\n1. **Check iOS version**: Use the `_ios_version_info` field to determine if you're running on iOS 16.0+ and handle the limitations accordingly.\n\n2. **Use available features**: Focus on features that work across all iOS versions:\n   ```dart\n   // These work on all iOS versions\n   final simInserted = iosInfo?.isSIMInserted ?? false;\n   final hasData = iosInfo?.networkStatus?.hasCellularData ?? false;\n   final radioTech = iosInfo?.carrierRadioAccessTechnologyTypeList ?? [];\n   ```\n\n3. **Graceful degradation**: Design your app to work without carrier-specific information on newer iOS versions.\n\n4. **Alternative approaches**: Consider using network-based detection or user input for carrier information when needed.\n\n5. **Android alternative**: For apps that require detailed carrier information, consider using the Android implementation which still provides full functionality.\n\n### New iOS Models\n\nThe plugin now includes enhanced models for iOS data:\n\n- **IosCarrierData**: Main container with all carrier information\n- **CarrierData**: Individual carrier information (nullable fields for iOS 16.0+)\n- **SubscriberInfo**: Subscriber and carrier token information\n- **CellularPlanInfo**: Cellular plan provisioning information\n- **NetworkStatus**: Real-time network connectivity status\n\n### Technical References\n\n- [Apple Developer Documentation - CTCarrier](https://developer.apple.com/documentation/coretelephony/ctcarrier)\n- [Apple Developer Documentation - CTSubscriber](https://developer.apple.com/documentation/coretelephony/ctsubscriber)\n- [Apple Developer Documentation - CTCellularPlanProvisioning](https://developer.apple.com/documentation/coretelephony/ctcellularplanprovisioning/)\n- [Stack Overflow Discussion](https://stackoverflow.com/questions/76919011/ctcarrier-deprecation-issue-ios-16)\n- [iOS 16.0 Release Notes](https://developer.apple.com/documentation/ios-ipados-release-notes/ios-ipados-16-release-notes)\n\n### Permissions\nYou should add permissions that are required to your android manifest:\n\n```xml\n  \u003cuses-permission android:name=\"android.permission.ACCESS_NETWORK_STATE\" /\u003e\n  \u003cuses-permission android:name=\"android.permission.READ_BASIC_PHONE_STATE\" /\u003e\n  \u003cuses-permission android:name=\"android.permission.READ_PHONE_STATE\" /\u003e\n  \u003cuses-permission android:name=\"android.permission.READ_PHONE_NUMBERS\" /\u003e\n  \u003cuses-permission android:name=\"android.permission.ACCESS_COARSE_LOCATION\" /\u003e\n  \u003cuses-permission android:name=\"android.permission.ACCESS_FINE_LOCATION\" /\u003e\n  \u003cuses-permission android:name=\"android.permission.READ_PRIVILEGED_PHONE_STATE\" /\u003e\n```\n\n## ✨ Contribution\n\nLots 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.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfinix%2Fcarrier_info","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzfinix%2Fcarrier_info","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzfinix%2Fcarrier_info/lists"}