In my application I want to retrive the device phone number. I used Phone.getDevicePhoneNumber(true)
It is working in the simulator, but when I test on the device it returns an empty string.
Is there any other option for getting the device phone number?
I am using jde 4.5.0.
The straightforward approach would be to ask the user to enter their phone number.
Phone.getDevicePhoneNumber(true) reads the number from the SIM card. The problem is the number isn't always on the SIM card. I've also seen cases where the wrong number is on the SIM card.
There is no guaranteed way to programmatically get the number. What I've done in the past is present the SIM card number to the user and asked them to correct/confirm it.
Related
My client is providing an international / long distance call service at cheap price to people if they make such calls via his company (Yes. It's like an international phone card)
The following is what my client wants to make.
Let's assume I have bunch of international / long distance / local phone numbers to call stored on my iPhone. If I tap one of the local phone numbers, iOS just lets me directly call the number. Not a problem. However, if it's an international or long distance number, iOS makes a call to the company instead so that the user can use the service at cheaper price.
Of course, this should happen only in the application. I'm not trying to tweak how iOS works by default.
I wonder if it's technically possible on iOS.
Update
I just came up with an idea that popping up a msg box if the tapped number is an international / long distance number before the following msg box by iPhone pops up.
Yup. before this one.
Can I show my custom msg box before the deafult one?
It sounds technically possible. The user can grant access to the contacts to the app which would allow the app to read names and phone numbers. The app could analyze the numbers and determine which ones are international and dial a LD service instead.
I would think that as long as the app is being completely clear to the user which service is being called and charges that may be incurred, I would think Apple would be okay with that.
The only other rule might be if the app looks too much like the built-in phone app or if it is determined the the functionality is redundant to the phone app. Good luck, Apple policy is sometimes a bit mysterious.
As for the alert, you can show any message, or even none at all.
I just installed the My Verizon Mobile app onto an iPhone and upon launch it was immediately able to display the device's phone number - something which is not possible for regular apps to do.
Does anybody know how it does it, could it be one of these, or something else?
As the app is from Verizon, Apple has granted it permission to access private iOS APIs to obtain the phone number
The App makes an HTTP connection to a Verizon server which goes through a gateway which is able to detect the phone number and sends it back to the device in the HTTP response.
These are just my guesses as to what perhaps could be happening, does anybody know what actually is happening?
If you go to Settings/General/About, you'll find an IMEI number and an ICCID number. The IMEI number identifies the phone, the ICCID number identifies the SIM card. If you have a Verizon phone account, then Verizon would have associated that ICCID number with a phone number. They must be able to do that, because otherwise how could Verizon ring your phone if I dial your number?
So what happens is Verizon using their own data, which they must have for your phone to function properly, to find the phone number associated with your SIM card. This should only work for Verizon phones (other phone companies should be able to find your phone number if you have a contract with them, but not if you are with Verizon).
By the way, if you go to Settings/Phone, the first thing my iPhone shows is "My Number".
The Verizon Mobile app, at least for android, carries special code apps in the rom. You cna verify this by taking a Verizon Galaxy Nexus and applying an alternate rom to it such as CM10. Without the special "carrier blobs" in the rom, Verizon "specialized apps", don't work.
This is not a bug per se -- non Verizon roms lack the special "carrier bits" but also like the carrier apps many people don't want on their Nexi. The reason you have no "auto login" on iPhones is because this carrier "app" doesn't exist in the Apple roms.
I would like to programatically get the device phone number (on iOS5 and iOS6).
Are there any unofficial ways for doing so?
Are there any private Core Telephony APIs or IOKit APIs that can be used for example?
And yes I do know my app won't be accepted in the AppStore
Private API
There is a private API to get phone number. Private API can't be submitted to AppStore, but it can be executed on jailed device.
NSString* CTSettingCopyMyPhoneNumber();
It returns phone number. And it's located in CoreTelephony
MDM
And actually, there is even a legal way of getting phone number. However, it's complicated. There is MDM protocol for iOS. One of the commands retrieves information about a device and this info includes phone number (and a lot of other device info).
Other notes
Also, you may be interested to read through these several questions:
Programmatically get own phone number in iOS
How can I get the phone number of my iPhone device?
You could start by searching in the private headers.
Is there a way in BlackBerry programmatically replace the phone number with the fake one, so when the SMS, which was sent from such a phone, will be received the recipient will see in 'from' field the faked number?
AFAIK its not possible. You can't show the faked number after receiving the SMS.
It is not possible. This kind of thing is against the security of the blackberry and we all know that blackberry provides very high level of security.
Is it possible to get the phone number or a unique ID identifying the phone from a WebApp on the iphone?
No, too large of a privacy/security issue.