android how to get the emergency number to call - 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?

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.

Related

how to text a clickable phone number including extension on android messages

How do I text a clickable phone number that includes the wait to dial extension on android messages?
on iOS I would simply type 8008008000; 123456# and I can even text that to iOS from android and it works, but when I text that to other android phones, the full link gets broken and android only dial the number from the message, requiring going back to the message to copy the extension for paste into dialer of active call.
I want the wait functionality, not the pause function.
I can create contacts in android like 8008008000; 123456# and they operate as desired, the solution I am after will not include creating the contact then sharing the contact.
I need to know what to type in and hit send, and it work for the recipient as desired.
typically it would be a comma (8008008000,123456# with NO spaces.) but its been my experience that .5 seconds (,) is insufficient for the number to be picked up and the IVR to register. a full second is more common, (8008008000,,123456# ) however, Android doesnt seem to parse a double-comma.

Retrieving default number for contact

I have read How to detect the default phone number of a contact (if set), but it seems that IS_SUPER_PRIMARY only works on some phones, is there a better solution to get the default number for a contact?
I believe this simply is one of those device dependent things. I'd use IS_SUPER_PRIMARY and when it returns nothing I'd just pick one from the list of numbers or let the user pick which to use. Alternatively you should look into which number from a list the user has used most often and use this as the primary.

How to obtain Phone Number in Android?

This is an extension to the question here. Now I quote CommonsWare
There is no reliable way to retrieve mobile number of device programatically. The only option remaining and I can think of is getting user to input for the phone number.
My question is how to check if the phone number entered by the user is correct for these and any more possibilities which I cannot think now:
The number entered by the user is of the same device the app has been downloaded on.
User did not make any typographical error while entering the number
User did not enter any local calling code like leading 0
I have spend sufficient time on StackOverflow and web and this is not a duplicate question.
I will appreciate any help, clues or suggestions.
1.The number entered by the user is of the same device the app has been downloaded on.
Again this is something kind of impossible to test, else the Tricky way mentioned by #neteinstein
2.User did not make any typographical error while entering the number
3.User did not enter any local calling code like leading 0
I think you still not aware of this library by google,used for Parsing/formatting/validating phone numbers for all countries/regions of the world.
Using that you can achive your other 2 solutions.I think.
Link : http://code.google.com/p/libphonenumber/
If you are willing to possibly spend some user money you can send an SMS to yourself (number inputted by the user) and check if it arrives.
If it does, the number is correct. If not... either you have no network, or the number is incorrect.
I don't even think the phone has the number visibility, according to my experience with Mobile Operators, only on their side they have that visibility.
Though I do not know about nr1, I think you can solve problem nr 2 and 3 quite easily by analysing the number while its a String. That way you can easily check what characters it contains and what positions these characters are on.
I hope this helps.
Greets,
Wottah

CALL_PHONE vs CALL_PHONE_PRIVLEGED

What is difference between permissions CALL_PHONE and CALL_PHONE_PRIVLEGED. After reading there definitions it appears they do more or less the same things.
CALL_PHONE: Allows an application to initiate a phone call without going through the Dialer user interface for the user to confirm the call being placed.
CALL_PRIVILEGED: Allows an application to call any phone number, including emergency numbers, without going through the Dialer user interface for the user to confirm the call being placed.
Can someone please explain the minute difference between the two?
any phone number, including emergency numbers
"Can dial 911" (or other emergency numbers, as valid in the specific location - e.g. 112 in EU)
You probably don't want just any ol' app calling the police of its own accord.

Android & iOS access number dialing

I am very new to both these operating systems so please excuse me if my question is basic :-)
We are planning a secure dialing system which means dialiing 2 numbers in one phone number dailing session.
Currently we have a system which allows us to dail an access number, wait for a tone and then dial a full telephone number.
It's a bit elaborate but like I said, it's a security feature.
What we are now trying to do is create Android and iPhone apps that will allow us to dial the access number + telephone number at the click of a virtual button :-)
Can anyone tell me how this can be accomplished programmatically? I need to implement something like access-number#phone-number or anything that works.
Thanks.
Both iphone and android support making phone calls in the same sort of manner.
You need to construct a URL and 'run' the url. Both iphone and android don't support any sort of call control so you have to make do with the url to make a phone call. They both support 'pause' character and dtmf tones in the url.
The iphone don't support some characters, notably the '#' and '*' characters. Because the '#' character is not supported (for security reasons), it can make it hard dealing with PBX systems.
On the android you have to 'encode' characters manually or using URLEncoder. I have not had any luck supporting the '#' character in Android but I have seen reports of it working. You will need to test this to see if it works for you.
For iphone you use the UIApplication openURL: to a tel link.
e.g.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"tel:123456p12345"]];
For android you use the INTENT_DIAL or ACTION_CALL.
INTENT_CALL will display the phone dialler with you number filled out. It does not require any special setup.
e.g.
Intent dialIntent = new Intent(Intent.ACTION_DIAL, Uri.parse("tel:123456"));
startActivity(dialIntent);
ACTION_CALL requires the CALL_PHONE permission in your manifest file.
e.g.
AndroidManifest.xml:
Intent dialIntent = new Intent(Intent.ACTION_CALL, Uri.parse("tel:123456%2C12345"));
startActivity(dialIntent);
I'm not quite sure if this is what you're looking for but.
You could create a button in your layout.
Create a pointer to it in your main activity // findViewById();
OnClickListener on the Button.
in the onClick, fire a Dial Intent with the number of choice.
If this isn't what you're looking for I'm afraid I'll need a bit more information on what it truely is, because at this point that's the only thing I can manage to think of with the description given.

Categories

Resources