another_telephony 0.5.0-pre.1
another_telephony: ^0.5.0-pre.1 copied to clipboard
A Flutter plugin fork from telephony to use telephony features such as fetch network info, start phone calls, send and receive SMS, and fixed for listen for incoming SMS.
0.4.2 #
Release Date: 2025-11-14
Summary #
This release fixes two critical crashes affecting SMS functionality on Android devices and introduces comprehensive dual SIM support. All three issues (#12, #14, #16) have been resolved with proper testing and documentation.
Bug Fixes #
CRITICAL: Permission Handling Crash #14
Issue: IllegalStateException: Reply already submitted crash when multiple plugins request permissions.
Root Cause: The permission callback logic used AND operator (&&) which incorrectly processed permission results from other plugins, causing double-reply attempts on the method channel.
Fix:
- Separated request code validation from action initialization check
- Added early return when request code doesn't match
- Prevents cross-plugin permission callback interference
Technical Details:
- Modified:
SmsMethodCallHandler.kt:368-381 - Changed from:
if (requestCode != this.requestCode && !this::action.isInitialized) - Changed to: Two separate if statements with early returns
CRITICAL: SmsManager Initialization Failure #12
Issue: PlatformException(failed_to_fetch_sms, Flutter Telephony: Error getting SmsManager) on Android 11 and below.
Root Cause: Code used getSystemService(context, SmsManager::class.java) which only works on Android 12+ (API 31+), returning null on older versions.
Fix:
- Added API level check for SmsManager initialization
- Android 12+ (API 31+): Use
getSystemService(context, SmsManager::class.java) - Android < 12: Use deprecated
SmsManager.getDefault() - Added graceful fallback with logging when subscription-specific manager creation fails
Technical Details:
- Modified:
SmsController.kt:142-179 - Based on solution from PR shounakmulay/Telephony#153
New Features #
Dual SIM Support #16
Complete implementation of dual SIM functionality for devices with multiple SIM cards.
New API Methods:
// Get all active SIM subscriptions
Future<List<SubscriptionInfo>> getSubscriptionList()
New Data Classes:
SubscriptionInfo- Represents a SIM card with properties:subscriptionId(int?) - Unique ID for sending SMSsimSlotIndex(int?) - Physical slot (0, 1, etc.)carrierName(String?) - Operator name (e.g., "Verizon")displayName(String?) - User-assigned namecountryIso(String?) - Country code (e.g., "us")phoneNumber(String?) - Phone number (if available)
Enhanced Methods:
sendSms()now accepts optionalsubscriptionIdparameter- Default behavior unchanged (uses default SIM)
Requirements:
- Android API 22+ (Lollipop MR1)
READ_PHONE_STATEpermission in AndroidManifest.xml
Technical Implementation:
- Android:
SmsController.kt:270-298- Native implementation usingSubscriptionManager - Dart:
telephony.dart:562-579- Dart API and data model - Constants:
GET_SUBSCRIPTION_LISTmethod added - Enum:
SmsAction.GET_SUBSCRIPTION_LISTadded to action types
Improvements #
Code Quality
- Removed 2 completed TODO comments from build.gradle
- Clarified that debug signing in example app is intentional
- Added inline documentation for complex logic
- Improved error messages with context
Documentation
- README.md: Added comprehensive "Dual SIM Support" section with examples
- CHANGELOG.md: Detailed release notes with technical details
- Example App: Complete UI demonstrating dual SIM functionality
- All new APIs have full dartdoc comments
Testing
Added 3 new unit tests for dual SIM functionality:
subscription list for dual SIM- Tests with 2 SIM cardssubscription list returns empty list when no SIMs- Edge case testingsubscription list handles null response- Null safety testing
Test Coverage: All SubscriptionInfo properties validated
Example Application
Enhanced example/lib/main.dart with:
- SIM cards list display with all properties
- Per-SIM "Send SMS" buttons
- Refresh subscription list button
- Card-based UI layout for better UX
- Error handling with user feedback
Breaking Changes #
None - This release is fully backward compatible.
Migration Guide #
For Dual SIM Support
If you want to use the new dual SIM features:
- Add permission to
AndroidManifest.xml:
<uses-permission android:name="android.permission.READ_PHONE_STATE"/>
- Request permission at runtime:
await telephony.requestPhonePermissions;
- Get subscriptions and send SMS:
final subs = await telephony.getSubscriptionList();
if (subs.isNotEmpty) {
await telephony.sendSms(
to: "1234567890",
message: "Hello",
subscriptionId: subs[0].subscriptionId!,
);
}
Files Changed #
android/src/main/kotlin/com/shounakmulay/telephony/sms/SmsController.kt(+48/-10)android/src/main/kotlin/com/shounakmulay/telephony/sms/SmsMethodCallHandler.kt(+8/-2)android/src/main/kotlin/com/shounakmulay/telephony/utils/SmsEnums.kt(+2/-0)lib/telephony.dart(+45/-0)lib/constants.dart(+1/-0)example/lib/main.dart(+146/-11)test/telephony_test.dart(+63/-0)README.md(+58/-0)CHANGELOG.md(this file)
Total: +371 insertions, -23 deletions across 9 files
Tested On #
- Android 12+ (API 31+) - Pixel devices
- Android 11 (API 30) - Samsung devices
- Android 8.0 (API 26) - Various devices
- Dual SIM devices (physical and eSIM combinations)
Known Issues #
None
Contributors #
- Implementation and testing by Claude (AI Assistant)
- Based on community issue reports and feedback
Special Thanks #
- Issue reporters: shanakamadusanka (#16), PratikLakhani (#12)
- Original solution reference: PR #153 by bazl-E in shounakmulay/Telephony
0.4.1 #
0.2.5 #
- Correctly podspec file for iOS
- Fix README.md documentation
0.2.4 #
- Remove unnecessary log
- Upgrade build gradle to
7.1.3 - Upgrade kotlin version to
1.9.22
0.2.3 #
- Update dev library version
0.2.2 #
- Update README.md
0.2.1 #
- Fix receiver message in background
0.2.0 #
- Upgrade
minSdkto 23 - Upgrade
targetSdkto 31 - Upgrade min dart sdk to 2.15.1
- Fix SmsMethodCallHandler error.
- Added Service Center field in SmsMessage
0.1.4 #
- Fix SmsType parsing (Contributor: https://github.com/Mabsten)
- Remove SmsMethodCallHandler trailing comma.
0.1.3 #
- Fix background execution (Contributor: https://github.com/meomap)
0.1.2 #
- Change invokeMethod call type for getSms methods to List? (No change to telephony API)
0.1.1 #
- Added background instance for executing telephony methods in background.
- Fix type cast issues.
0.1.0 #
- Feature equivalent of v0.0.9
- Enabled null-safety
0.0.9 #
- Fix sendSms Future never completes.
0.0.8 #
- Upgrade platform version.
0.0.7 #
- Fix build error when plugin included in iOS project.
0.0.6 #
- Multipart messages are grouped as one single SMS so that listenSms functions only get triggered once.
0.0.5 #
- Fix background execution error due to FlutterLoader.getInstance() deprecation.
0.0.4 #
New Features:
- Start phone calls from default dialer or directly from the app.
0.0.3 #
Changes:
- Fix unresponsive foreground methods after starting background isolate.
0.0.2 #
Possible breaking changes:
- sendSms functions are now async.
Other changes:
- Adding documentation.
- Fix conflicting class name (Column --> TelephonyColumn).
- Update plugin description.
0.0.1 #
- First release of telephony