I have a flutter project that requires to run USSD codes in flutter as direct way to access mobile money of any carrier through my flutter app. USSD codes are mostly used in african countries. i came across an SDK called userhover but there are non documentation on how to use the SDK in flutter
-
Please read this [question](https://stackoverflow.com/questions/36912452/how-to-read-ussd-message-response-in-android), and then you can write custom platform-specific code. – Shady Boshra Aug 16 '19 at 19:20
2 Answers
Disclaimer: plugin author here.
Since Android API level 26, the method sendUssdRequest is exposed to make silent USSD requests.
I made a Flutter plugin called ussd_service to be able to easily access it from dart in a Flutter application. It can be used in the following manner:
import 'package:ussd_service/ussd_service.dart';
makeMyRequest() async {
int subscriptionId = 1; // sim card subscription Id
String code = "*21#"; // ussd code payload
try {
String ussdSuccessMessage = await UssdService.makeRequest(subscriptionId, code);
print("succes! message: $ussdSuccessMessage");
} on PlatformException catch (e) {
print("error! code: ${e.code} - message: ${e.message}");
}
};
makeMyRequest();
If you are targeting only Android, this could be helpful. Unfortunately, iOS doesn't support running silent USSD requests. Let me know on the Github repo's issues if you have any issue with it.

- 2,047
- 1
- 14
- 9
-
but this package doesn't work on android APIs less than 26...is there a way to make it work?? – biniyam112 Jan 16 '21 at 08:07
-
sendUssdRequest was added with API level 26, so if you need to support previous versions, you have to use another plugin – vkammerer Jul 12 '21 at 07:42
There is an android SDK called Hover, it helps to automate USSD sessions in the background of Android applications.The SDK can run virtually any USSD interaction on any mobile operator anywhere in the world. This includes mobile money, airtime topup etc.
Here's a tuto of how to integrate it in flutter

- 191
- 1
- 9