问题描述
我有一个可以使用USSD电话的应用程序,但是在所有的USSD电话之后,我得到一个结果对话框给用户。
I have an app that make USSD calls, but after all USSD calls i got a dialog with the result to the user.
我知道这是可以解雇的这个对话框是因为USSD Checker应用程序执行此操作,他们从USSD获取响应,而不显示用户对话框。
I know that is possible to dismiss this dialog because the "USSD Checker" app do this, they get the response from USSD without showing the user dialog.
在
有功能 displayMMIComplete
完成Ussd调用后,显示一个 TYPE_SYSTEM_DIALOG 。在PhoneUtils.java中,他们使用如下对话框:
Has the function displayMMIComplete
that after complete the Ussd call, show a TYPE_SYSTEM_DIALOG. In the PhoneUtils.java they use the dialog like this:
AlertDialog newDialog = new AlertDialog.Builder(context)
.setMessage(text)
.setPositiveButton(R.string.ok, null)
.setCancelable(true)
.create();
newDialog.getWindow().setType(
WindowManager.LayoutParams.TYPE_SYSTEM_DIALOG);
newDialog.getWindow().addFlags(
WindowManager.LayoutParams.FLAG_DIM_BEHIND);
newDialog.show();
然后我不能发送一些标志来关闭它。我不能使用该导入它的系统类。
Then i can't just send some flag to dismiss it. And I can't use that import its a system class.
当我做X连续调用时,会出现X对话框给用户关闭,我的应用程序将需要做连续调用,无论如何以编程方式关闭此系统对话框?
And when I do X consecutive calls appears X dialogs to the user close, and my app will need to do consecutive calls, there is anyway to programmatically close this System dialog?
推荐答案
如果您正在尝试,我找到了一个答案使用USSD通话您可以禁用结果文本
I found an Answer to my question if you're trying to use USSD Calls you can disable the result text
在俄罗斯博客中有一个,显示如何连接到android的phoneutils服务,然后控制USSD(CALL和RESULT)的文本。他使用界面(IExtentedendNetworkService)显示一个示例,它在Android操作系统启动时绑定在手机实用程序上,如果没有任何其他应用程序尝试执行此操作(因为只有一个服务可能会被绑定,我不知道Android操作系统用来选择的规则。
In a russian blog there is a post that show how you can connect to the phoneutils service of android, then control the texts from USSD (CALL and RESULT). He show a sample using a interface (IExtentedendNetworkService ) that binds on phone utils just on the android OS start and if there was not any other app trying to do the same (Because just one service can be bound and maybe will be your or not, I don't know the rule that Android OS uses to choose).
在函数CharSequence getUserMessage(CharSequence text)中,如果返回null,结果对话框将不会出现。
In the function "CharSequence getUserMessage(CharSequence text);" if you return null the result dialog will not appear.
这篇关于如何以编程方式关闭/取消/关闭系统对话框(Android)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!