Make a Call in on number followed by # key

2019-01-29 09:53发布

I am working on the calling app where I make call on button click but if the number just followed by # then it does not take the # key at the last of phone number.

For Example if I want to make a call on *123# from app then it only shows *123 in the calling screen in phone. Please suggest me where I am going wrong.

Here is my code for call on *123# on button click.

Intent callIntent = new Intent(Intent.ACTION_CALL);
callIntent.setData(Uri.parse("tel:" + phoneNumber));
callIntent.setData(Uri.parse("tel:" + "*123#"));
startActivity(callIntent);

2条回答
乱世女痞
2楼-- · 2019-01-29 10:19

You need to escape the # as a URI entity: %23

查看更多
何必那么认真
3楼-- · 2019-01-29 10:24

try this...

Intent callIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:"+ Uri.encode("*123#")));
startActivity(callIntent);
查看更多
登录 后发表回答