On Mar 23, 2013, at 9:14 AM, Gangadhar Nittala <[email protected]> wrote:

> On Friday, March 22, 2013 9:12:20 PM UTC+5:30, Andrew Overholt wrote:
>> Hi,
>> 
>> 
>> 
>>> Anybody knows how to get the phone number from the device?
>> 
>> 
>> 
>> Go to Settings and select Device Information.  The phone number should 
>> 
>> be displayed at the top.  If you're asking about programmatically 
>> 
>> determining it, I'd recommend looking at the JS code that does this.  
>> 
>> Although I think Settings may have elevated privileges to do so.
>> 
>> 
>> 
>> HTH,
>> 
>> 
>> 
>> Andrew
> 
> You can take a look at this function in gaia that retrieves the phone number 
> as part of the device-information
> 
> https://github.com/mozilla-b2g/gaia/blob/master/apps/settings/js/about.js
> 
> 
> loadHardwareInfo: function about_loadHardwareInfo() {
>    var mobileConnection = getMobileConnection();
>    if (!mobileConnection)
>      return;
> 
>    var info = mobileConnection.iccInfo;
>    document.getElementById('deviceInfo-iccid').textContent = info.iccid;
>    document.getElementById('deviceInfo-msisdn').textContent = info.msisdn;

I'm not sure exactly what you were trying to do with the phone number but keep 
in mind this value may have been tampered with by a user who has access to the 
device. For example, when we do carrier billing we do things like network 
header authorization (with the operator) to trust the MSISDN.

> 
>    var req = mobileConnection.sendMMI('*#06#');
>    req.onsuccess = function getIMEI() {
>      document.getElementById('deviceInfo-imei').textContent = req.result;
>    };
> 
> hth
> _______________________________________________
> dev-webapps mailing list
> [email protected]
> https://lists.mozilla.org/listinfo/dev-webapps

_______________________________________________
dev-webapps mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-webapps

Reply via email to