android 如何获取紧急电话号码

发布于 2024-10-17 04:07:24 字数 269 浏览 0 评论 0原文

我看到有很多关于如何拨打号码的示例,而且我还看到我只能弹出拨号器才能拨打紧急号码。但在所有这些示例中,他们将“911”硬编码为要使用的号码。嗯,这在美国工作得很好,但由于 Android 手机在其他国家/地区销售,因此我的应用程序有可能会被不在美国的人购买,或者居住在美国的人可能会将手机带到海外;有没有办法让我的应用程序意识到它不在美国,因此必须使用不同的号码来呼叫紧急服务,该号码是什么?

总而言之,我想知道是否有一种方法可以让应用程序在拨号器中显示其所在国家/地区的紧急号码,而无需在编译时知道该号码?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

风情万种。 2024-10-24 04:07:24

根据 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");
}

号码将是逗号分隔的列表。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文