AT command – USSD

The format of the command is AT+CUSD=[<n>[,<str>[,<dcs>]]], and the second parameter, <str>, is a string that should be enclosed in double quotes. E.g. AT+CUSD=1,”*555*87*1234#” AT+CUSD=1,”1″ See 27.007 for more details about AT+CUSD and V.250 for general AT command handling. If your phone gives an OK response to AT+CUSD=1,1 that is really bad, it should have … Read more

Make USSD call in android

This works for me: private Uri ussdToCallableUri(String ussd) { String uriString = “”; if(!ussd.startsWith(“tel:”)) uriString += “tel:”; for(char c : ussd.toCharArray()) { if(c == ‘#’) uriString += Uri.encode(“#”); else uriString += c; } return Uri.parse(uriString); } Then in work code: Intent callIntent = new Intent(Intent.ACTION_CALL, ussdToCallableUri(yourUSSDCodeHere)); startActivity(callIntent);

Prevent USSD dialog and read USSD response?

It is possible using accessibility service. First create a service class: public class USSDService extends AccessibilityService { public static String TAG = USSDService.class.getSimpleName(); @Override public void onAccessibilityEvent(AccessibilityEvent event) { Log.d(TAG, “onAccessibilityEvent”); AccessibilityNodeInfo source = event.getSource(); /* if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED && !event.getClassName().equals(“android.app.AlertDialog”)) { // android.app.AlertDialog is the standard but not for all phones */ if … Read more

How is it possible to do USSD requests on Android?

Ussd api was added in API26. So since Oreo working with ussd looks smt like this: TelephonyManager manager = (TelephonyManager)getSystemService(TELEPHONY_SERVICE); manager.sendUssdRequest(“*100#”, new TelephonyManager.UssdResponseCallback() { @Override public void onReceiveUssdResponse(TelephonyManager telephonyManager, String request, CharSequence response) { super.onReceiveUssdResponse(telephonyManager, request, response); } @Override public void onReceiveUssdResponseFailed(TelephonyManager telephonyManager, String request, int failureCode) { super.onReceiveUssdResponseFailed(telephonyManager, request, failureCode); } }, new Handler()); … Read more