Android:Simple USSD Dialer Application

前端 未结 1 1759
借酒劲吻你
借酒劲吻你 2021-01-31 23:21

I have created a simple dialer to quickly help me dial mobile provider services like checking air balance, getting internet settings from the provider

//example
         


        
1条回答
  •  被撕碎了的回忆
    2021-02-01 00:10

    You should escape the # symbol with %23

    //example phoneNum[1] = "*144";

    String encodedHash = Uri.encode("#");
    startActivity(new Intent("android.intent.action.DIAL",
                  Uri.parse("tel:"+ phoneNum[1]+ encodedHash)));
    

    As for the catching the response, you should experiment with

    startActivityForResult(new Intent("android.intent.action.CALL", 
                       Uri.parse("tel:"+ phoneNum[1]+ encodedHash)), 1);
    @Override
    protected void onActivityResult(int requestCode, int resultCode,Intent data) {
        view.setText("USSD: " + requestCode + " " + resultCode + " " + data);
    }
    

    and see what will that return you.

    0 讨论(0)
提交回复
热议问题