/VoIpUSSD

How use ussd displayed windows on Android

Primary LanguageJavaApache License 2.0Apache-2.0

Handler USSD API

Platform API License Bintray Android Arsenal Jitpack

by Romell Dominguez

Target Development:

To comunicate with ussd display, It is necessary to have present that the interface depends on the SO and on the manufacturer of Android device.

USSD LIBRARY

latestVersion is 1.0.b

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

repositories {
    jcenter()
}
dependencies {
    compile 'com.romellfudi.ussdlibrary:ussd-library:{latestVersion}'
}

Build a accessibility service class:

image

Capture information from USSD displaying windows, excist two ways:

  • Writting code:

image

  • Writting xml, this link manifest to SO:
<?xml version="1.0" encoding="utf-8"?>
<accessibility-service xmlns:android="http://schemas.android.com/apk/res/android"
    android:accessibilityEventTypes
        ="typeWindowStateChanged"
    android:packageNames="com.android.phone"
    android:accessibilityFeedbackType="feedbackGeneric"
    android:accessibilityFlags="flagDefault"
    android:canRetrieveWindowContent="true"
    android:description="@string/accessibility_service_description"
    android:notificationTimeout="0"/>

Application

Configure build.gradle file, add exteension for run aar libraries(witch we build and export)

allprojects { repositories { ...
        flatDir { dirs 'libs' } } }

Configure ussd library dependencies on app module {debugCompile: attach library module, releaseCompile: import *.aar library}

dependencies {
    ...
    //debugCompile project(':ussdlibrary')
    //releaseCompile(name: 'ussdlibrary-{latestVersion}', ext: 'aar')
    implementation 'com.romellfudi.ussdlibrary:ussd-library:{latestVersion}'
}

Puts dependencies on manifest, into manifest put CALL_PHONE, READ_PHONE_STATE and SYSTEM_ALERT_WINDOW:

image

image

Use Voip line

In this secction leave the lines to call to Telcom (ussd hadh number) for connected it:

ussdPhoneNumber = ussdPhoneNumber.replace("#", uri);
Uri uriPhone = Uri.parse("tel:" + ussdPhoneNumber);
context.startActivity(new Intent(Intent.ACTION_CALL, uriPhone));

Once initialized the call will begin to receive and send the famous USSD windows

image

<style> img[src*='#center'] { width:390px; display: block; margin: auto; } img[src*='#gif'] { width:200px; display: block; margin: auto; } </style>