简体   繁体   中英

Moving to dial screen when calling to 911 using intent with ACTION_CALL

I am working on an app which dials to several numbers automatically and send a report once it's finished. One of the phone numbers is '*9112'. When my app tries to dial to this number it moves to the phone dialing app, instead of starting the phone call. My guess is that it thinks that it's an emergency number and this is the reason why it shifts to the phone dialing app. Is there a way to avoid it?

This is the part in my code which do the auto-dial:

private void makePhoneCall(String phoneNumber) {
    Log.i("makePhoneCall", "Calling " + phoneNumber);
    Intent intent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phoneNumber));
    activity.startActivity(intent);
    hangUpAndCallNextNumber();
}

This happened only on the simulator. Eventually when I tested it on a physical device it didn't happen. Plus I did not check it, but I assume that it may happen only on simulators which were setup with a country that 911 is it's emergency number (like the US and Mexico).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM