SkillAgentSearch skills...

VoIpUSSD

:octocat: 📞 IMEI (USSD) Library in Android Devices by @romellfudi

Install / Use

/learn @romellfudi/VoIpUSSD

README

<h1 align="center">VOIP USSD ANDROID</h1>

Gemini_Generated_Image_utk8amutk8amutk8

<p align="center"> <a href="https://developer.android.com/index.html"><img src="https://img.shields.io/badge/platform-android-brightgreen.svg?&amp;logo=android" alt="Platform"></a> <a href="https://android-arsenal.com/api?level=23"><img src="https://img.shields.io/badge/API-23%2B-brightgreen.svg?style=flat&amp;logo=android" alt="API"></a> <a href="https://github.com/romellfudi/VoIpUSSDSample/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg?&amp;logo=apache" alt="License"></a> <a href="https://github.com/romellfudi/VoIpUSSD/actions"><img src="https://github.com/romellfudi/VoIpUSSD/workflows/Android%20CI/badge.svg" alt="Workflow"></a> <a href="https://gitter.im/romellfudi/VoIpUSSD?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge"><img src="https://img.shields.io/badge/gitter-join%20us-%23753a89.svg?&amp;style=flat&amp;logo=gitter&amp;labelColor=ee1a67" alt="Gitter"></a> <a href="https://bintray.com/romllz489/maven/ussd-library"><img src="https://img.shields.io/bintray/v/romllz489/maven/ussd-library.svg?&amp;logo=jfrog-bintray" alt="Bintray"></a> <a href="https://bintray.com/romllz489/maven/kotlin-ussd-library"><img src="https://img.shields.io/bintray/v/romllz489/maven/kotlin-ussd-library.svg?&amp;logo=jfrog-bintray" alt="Bintray Kotlin"></a> <a href="https://android-arsenal.com/details/1/7151"><img src="https://img.shields.io/badge/Android%20Arsenal-Void%20USSD%20Library-green.svg?style=flat?&amp;logo=android-studio" alt="Android Arsenal"></a> <a href="https://jitpack.io/#romellfudi/VoIpUSSD"><img src="https://jitpack.io/v/romellfudi/VoIpUSSD.svg" alt="Jitpack"></a> </p> <p align="center"> <i>Loved the tool? Please consider <a href="https://paypal.me/romellfudi/15">donating</a> 💸 to help it improve!</i> </p> <p align="center"> <a href="https://www.paypal.me/romellfudi"><img src="https://img.shields.io/badge/support-PayPal-blue?logo=PayPal&style=flat-square&label=Donate" alt="sponsor voip android library"/> </a> <p align="center"> <a href="#ussd-library">Usage</a> &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; <a href="#static-methods">Extra Features</a> &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; <a href="#cordova-plugin">Cordova Plugin</a> &nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp; <a href="#contributors-">Contributors</a> </p>

by Romell Dominguez

<h1 align="center">Architecture Overview</h1> <img width="2816" height="1536" alt="architecture_overview" src="https://github.com/user-attachments/assets/040f7a7e-ab97-4037-9745-fbf3f26d701e" />

Target Development High Quality:

<p align="center"> <a href="https://raw.githubusercontent.com/romellfudi/VoIpUSSD/Rev04/snapshot/device_recored.gif"><img src="https://raw.githubusercontent.com/romellfudi/VoIpUSSD/Rev04/snapshot/device_recored.gif" alt="Jitpack"></a> </p>

Interactive with ussd windows, remember the USSD interfaces depends on the System Operative and the manufacturer of Android devices.

Community Chat

Gitter

Downloads Dashboard

Data Studio

USSD LIBRARY

Implementations

Add the following dependency in your app's build.gradle configuration file:

| Repository | implementation | Status | | :------: | ------ | :------: | | jcenter() | 'com.romellfudi.ussdlibrary:ussd-library:1.1.i' | DEPRECATED | | jcenter() | 'com.romellfudi.ussdlibrary:kotlin-ussd-library:1.1.k' | DEPRECATED | | maven { url https://jitpack.io } | 'com.github.romellfudi.VoIpUSSD:ussd-library:1.4.a' | READY | | maven { url https://jitpack.io } | 'com.github.romellfudi.VoIpUSSD:kotlin-ussd-library:1.4.a' | READY |

  • Writing a config xml file from here to res/xml folder (if necessary), this config file allow to link between Application and System Oerative:
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
    .../>

Application Permissions

To use the application, add the following permissions to your AndroidManifest.xml:

<uses-permission android:name="android.permission.CALL_PHONE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />

Service Configuration

Include the service in your AndroidManifest.xml for Java:

<service
    android:name="com.romellfudi.ussdlibrary.USSDService"
    android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
    <intent-filter>
        <action android:name="android.accessibilityservice.AccessibilityService" />
    </intent-filter>
    <meta-data
        android:name="android.accessibilityservice"
        android:resource="@xml/ussd_service" />
</service>

Or for Kotlin:

<service
    android:name="com.romellfudi.ussdlibrary.USSDServiceKT"
    android:permission="android.permission.BIND_ACCESSIBILITY_SERVICE">
    <intent-filter>
        <action android:name="android.accessibilityservice.AccessibilityService" />
    </intent-filter>
    <meta-data
        android:name="android.accessibilityservice"
        android:resource="@xml/ussd_service" />
</service>

NOTE: You may want to override android:notificationTimeout="0"to a corresponding value of 200 or avobe by copying the contents of @xml/ussd_service to the xml dir. Otherwise it is possible that the library will miss accessibility events during operation, resulting is unintended behaivours (e.g not reading up to date prompts #115 )

Usage Instructions

  1. Create a HashMap to identify USSD response messages for login and error scenarios:

| KEY MESSAGE | String Messages | | ------ | ------ | | KEY_LOGIN | "espere", "waiting", "loading", "esperando", ... | | KEY_ERROR | "problema", "problem", "error", "null", ... |

For Java:

Map<String, HashSet<String>> map = new HashMap<>();
map.put("KEY_LOGIN", new HashSet<>(Arrays.asList("espere", "waiting", "loading", "esperando")));
map.put("KEY_ERROR", new HashSet<>(Arrays.asList("problema", "problem", "error", "null")));

For Kotlin:

val map = HashMap<String, HashSet<String>>()
map["KEY_LOGIN"] = hashSetOf("espere", "waiting", "loading", "esperando")
map["KEY_ERROR"] = hashSetOf("problema", "problem", "error", "null")
  1. Instantiate a USSDController object and invoke a USSD code:

For Java:

USSDApi ussdApi = USSDController.getInstance(context);
ussdApi.callUSSDInvoke(phoneNumber, map, new USSDController.CallbackInvoke() {
    @Override
    public void responseInvoke(String message) {
        // Handle the USSD response
        String dataToSend = "data"; // Data to send to USSD
        ussdApi.send(dataToSend, new USSDController.CallbackMessage() {
            @Override
            public void responseMessage(String message) {
                // Handle the message from USSD
            }
        });
    }

    @Override
    public void over(String message) {
        // Handle the final message from USSD or error
    }
});

For Kotlin:

val ussdApi = USSDController.getInstance(context)
ussdApi.callUSSDOverlayInvoke(phoneNumber, map, object : USSDController.CallbackInvoke {
    override fun responseInvoke(message: String) {
        // Handle the USSD response
        val dataToSend = "data" // Data to send to USSD
        ussdApi.send(dataToSend) { responseMessage ->
            // Handle the message from USSD
        }
    }

    override fun over(message: String) {
        // Handle the final message from USSD or error
    }
})
  1. For custom message handling, structure your code as follows:

For Java:

// Example of selecting options from USSD menu
ussdApi.callUSSDInvoke(phoneNumber, map, new USSDController.CallbackInvoke() {
    ...
    // Select the first option
    ussdApi.send("1", new USSDController.CallbackMessage() {
        ...
        // Select the next option
        ussdApi.send("1", new USSDController.CallbackMessage() {
            ...
        });
    });
    ...
});

For Kotlin:

// Example of selecting options from USSD menu
ussdApi.callUSSDOverlayInvoke(phoneNumber, map,
View on GitHub
GitHub Stars194
CategoryDevelopment
Updated11h ago
Forks116

Languages

Java

Security Score

100/100

Audited on Mar 30, 2026

No findings