I am trying to make silent USSD request, I am using Ussd_Serivece & Sim_Service package for this in flutter.
any time I try to make a request it throws this exception: (error! Code: ussd_plugin_ussd_response_failed - messege PlatformException(ussd_plugin_ussd_response_failed, USSD_RETURN_FAILURE, null)).
here is a code of my function:
makeRequest() async {
String code = '*221#';
SimData data = await SimService.getSimData;
print(data.activeSubscriptionInfoCount);
print(code);
try {
String ussdRespMessege = await UssdService.makeRequest(
data.cards.first.subscriptionId, '211#');
print('Succes! messege: $ussdRespMessege');
} catch (e) {
print('error! Code: ${e.code} - messege $e');
}
}
I already handled permissions.
plugin author here.
It looks like the second parameter than you are passing to makeRequest
is missing a *
, so it is expected that you are getting an error.
Try to replace it with
String ussdRespMessege = await UssdService.makeRequest(
data.cards.first.subscriptionId, "*211#");
and it should work fine