开发者

android how to get the emergency number to call

开发者 https://www.devze.com 2023-02-10 12:43 出处:网络
I see there are plenty of examples on how to call a number, and I also see that I can only have it pop up the dialer to go to开发者_如何学编程 an emergency number.But in all those example they hard co

I see there are plenty of examples on how to call a number, and I also see that I can only have it pop up the dialer to go to开发者_如何学编程 an emergency number. But in all those example they hard coded "911" as the number to use. well this works fine in the US but since android phones are sold in other countries and thusly there is the possibility that my app will be bought by someone not in the US, or that someone who lives in the us may take their phone overseas; is there a way then my app can realize it's not in the us and thusly has to use a different number to call emergency service and what that number would be?

So to sum up I'd like to know if there is a way I can have it so when the app goes to bring up the dialer with the emergency number for the country it's in, with out having to know that number at complie time?


According to the source for PhoneNumberUtils.isEmergencyNumber():

String numbers = SystemProperties.get("ril.ecclist");
if (TextUtils.isEmpty(numbers)) {
    // then read-only ecclist property since old RIL only uses this
    numbers = SystemProperties.get("ro.ril.ecclist");
}

numbers will be a comma separated list.

0

精彩评论

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