我希望我的应用程序获得TextView值,并在其中添加#号并拨打USSD代码,但该程序只是正常拨号并显示包括的完整串联文本。

我正在使用Android 2.0

//To request permission and this work fine, because of its dialing. But I want it to run USSD not dial
@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
    if(requestCode == REQUEST_CALL){
        if(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED){
            makeCall();
        } else {
            Toast.makeText(this, "permission Denined.", Toast.LENGTH_SHORT).show();
        }
    }
}

Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + uSSD +phone+'*'+Amount+NairaSign));
startActivity(intent);

最佳答案

您可以尝试以下代码:
Uri.parse(“电话:” + uSSD +电话+“ *” +金额+ Uri.encode(NairaSign))
NairaSign应该具有值“#”,即字符串变量。确保在清单文件中使用android.permission.CALL_PHONE。

10-08 18:06