Calling a USSD number without opening the phone app in Android

你说的曾经没有我的故事 提交于 2019-12-08 01:28:42

问题


I am trying to call a USSD number from my application like this:

Uri u = Uri.fromParts("tel", "*110#", "");
Intent i = new Intent(Intent.ACTION_CALL, u);
startActivity(i);

This makes the phone app launch and call the number.

What I want is to call the USSD number without opening the phone app or atlease open it up in the background.

If the user is doing something, then he should not be disturbed. Only a notification must be generated.

any suggestions?


回答1:


Fortunately, this is not possible, except perhaps by your own custom firmware. If it were possible, malware would exploit it to place phone calls without the user's knowledge.




回答2:


it is possible now since android O(api 26) with sendUssdRequest() check the docs https://developer.android.com/reference/android/telephony/TelephonyManager.html#sendUssdRequest(java.lang.String,%20android.telephony.TelephonyManager.UssdResponseCallback,%20android.os.Handler)



来源:https://stackoverflow.com/questions/5449464/calling-a-ussd-number-without-opening-the-phone-app-in-android

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!