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;

    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

Reply via email to