ussd_service

Creator: coderz1093

Last updated:

0 purchases

ussd_service Image
ussd_service Images

Languages

Categories

Add to Cart

Description:

ussd service

Ussd plugin for Flutter #
This plugin makes it possible to access Android's sendUssdRequest method from a Flutter application.
Installation #
Add ussd_service as a dependency in your pubspec.yaml.
Make sure that your AndroidManifext.xml file includes the following permission:
<uses-permission android:name="android.permission.CALL_PHONE" />
copied to clipboard
Usage #
Before you use this plugin, you must:

make sure that the user has authorized access to his phone calls, for example with the permission_handler plugin.
retrieve the SIM card subscription ID, for example with the sim_data plugin.

You may then use the plugin:
import 'package:ussd_service/ussd_service.dart';

makeMyRequest() async {
int subscriptionId = 1; // sim card subscription ID
String code = "*#21#"; // ussd code payload
try {
String ussdResponseMessage = await UssdService.makeRequest(
subscriptionId,
code,
Duration(seconds: 10), // timeout (optional) - default is 10 seconds
);
print("succes! message: $ussdResponseMessage");
} catch(e) {
debugPrint("error! code: ${e.code} - message: ${e.message}");
}
};

void main() => makeMyRequest();
copied to clipboard
Interactive / multi steps USSD sessions #
Android's sendUssdRequest doesn't support interactive / multi steps USSD sessions, so this plugin doesn't support them either.
However, as mentioned by a user who reported it in a comment, you may be able to achieve similar behaviour by passing all arguments in a single USSD request.
*firstCode*2ndCode*3rdCode*4thCode*..*..#
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Customer Reviews

There are no reviews.