5

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?

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Kit Ramos
  • 1,533
  • 1
  • 15
  • 32
  • Look at the following answer for using SystemProperties: [Using SystemProperties][1] [1]: http://stackoverflow.com/questions/2641111/where-is-android-os-systemproperties – Kfir Erez Jun 24 '12 at 11:07

1 Answers1

5

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.

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Robby Pond
  • 73,164
  • 16
  • 126
  • 119
  • it doesn't work, it gave me an error when I tried that, said SystemProperties didn't exist. I also tried dooing it another way too wich didn't work either `String numbers = System.getProperty("ril.ecclist"); Log.d("numbers", "!"+numbers); if (TextUtils.isEmpty(numbers)) { numbers = System.getProperty("ro.ril.ecclist"); } Log.d("numbers", "!"+numbers);` that let me compile but numbers varable was null bouth times. – Kit Ramos Feb 12 '11 at 19:46
  • for some reason I can't get it to display my code properly anywase I was tying to use System.getProperties() as I couln't use SystemProperties.get() wouldn't let me import it. I couldn't find refrence to it on the android site, but I did find the other one I tried to use and was able to get it to compile but when I used log.d() to check the value of the string returned it was null – Kit Ramos Feb 12 '11 at 20:03
  • @KitRamos Go to the adb shell and run the command "getprop" and see if those properties are set. – 4aRk Kn1gh7 Jun 22 '15 at 06:45