Android Check if call forwarding is activated

后端 未结 4 1880
醉酒成梦
醉酒成梦 2021-01-13 21:19

I am building a call forwarding application and have used the **21*xxxxxx# ussd code to activate call fowarding using ACTION_CALL Intent. But I have not found a solution to

4条回答
  •  一向
    一向 (楼主)
    2021-01-13 21:59

    PRECAUTION: The following answer is suggestion. I haven't tried it personally So you better try it to check the result.

    From your gsm number you can check your call forwarding options by dialing *#21#. So you can try dialing this number from application and read the ussd response.

    part 1: to dial the number

    Intent intentCallForward = new Intent(Intent.ACTION_CALL);                               
    Uri uri = Uri.fromParts("tel", "*#21#", "#"); 
    intentCallForward.setData(uri);                                
    startActivity(intentCallForward);
    

    part 2: to read the ussd response

    There is no API to do this. But here in this SO answer it suggested some methods that you can try.

    Best of luck

提交回复
热议问题