Tuesday, 29 May 2018

interactive ussd session(multi step) does not work on android 8(Oreo)

I am currently working with Telephony Manager(USSD response) available in android api level 26(Nexus 6P). For single step ussd session, it's working.

reference: http://codedrago.com/q/140674/android-telephony-telephonymanager-ussd-android-8-0-oreo-does-android-8-0-api-26-support-sending-and-repying-to-ussd-messages

example:

USSD request : "A" (ussd session initiates)

USSD response : "X" (ussd session terminates)

    TelephonyManager =  telephonyManager(TelephonyManager)getSystemService(Context.TELEPHONY_SERVICE);
    Handler handler = new Handler();
    TelephonyManager.UssdResponseCallback callback = new TelephonyManager.UssdResponseCallback() {
        @Override
        public void onReceiveUssdResponse(TelephonyManager telephonyManager, String request, CharSequence response) {
            super.onReceiveUssdResponse(telephonyManager, request, response);
            Log.e("ussd",response.toString());

        }

        @Override
        public void onReceiveUssdResponseFailed(TelephonyManager telephonyManager, String request, int failureCode) {
            super.onReceiveUssdResponseFailed(telephonyManager, request, failureCode);
            Log.e("ussd","failed with code " + Integer.toString(failureCode));
        }
    };

    try {
           Log.e("ussd","trying to send ussd request");
           telephonyManager.sendUssdRequest("*123#",
                    callback,
                    handler);
        }catch (Exception e){


            String msg= e.getMessage();
            Log.e("DEBUG",e.toString());
            e.printStackTrace();
        }

but for interactive ussd request-response(multi-step), it's not working. Multi step scenario is as follows:

step # 1.

USSD request : "A" (ussd session initiates)

USSD response : "X"

step # 2.

USSD request : "B" (ussd session continues)

USSD response : "Y"

step # 3.

USSD request : "C"

USSD response : "Z" (ussd session terminates)



from interactive ussd session(multi step) does not work on android 8(Oreo)

No comments:

Post a Comment