开发者

Calling a USSD number without opening the phone app in Android

开发者 https://www.devze.com 2023-02-19 21:11 出处:网络
I am trying to call a USSD number from my application like this: Uri u = Uri.fromParts(\"tel\", \"*110#\", \"\");

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?


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)

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号