startMultiSessionUssd method
Starts a multi-session USSD session
ussdCode - The USSD code to start the session
subscriptionId - (Optional) Subscription ID (SIM slot).
If not provided and there are multiple SIMs, the native selector will be shown.
If there is only one SIM, it is used by default.
Returns a map with the operation result. Requires the accessibility service to be enabled.
Implementation
@override
Future<Map<String, dynamic>> startMultiSessionUssd(
String ussdCode, {
int? subscriptionId,
}) async {
try {
final Map<String, dynamic> arguments = {'ussdCode': ussdCode};
if (subscriptionId != null) {
arguments['subscriptionId'] = subscriptionId;
}
final result = await methodChannel.invokeMethod<Map<Object?, Object?>>(
'startMultiSessionUssd',
arguments,
);
return Map<String, dynamic>.from(result ?? {});
} on PlatformException catch (e) {
debugPrint('Error starting multi-session: ${e.message}');
return {'success': false, 'error': e.message};
}
}