2015-05-13 27 views
1

我正在開發Firefox OS的Web應用程序,我需要獲取MSISDN。我正在使用特權應用程序。如何獲得Firefox上的MSISDN操作系統

這裏是我的清單:

{ 
"version": "0.1", 

"type": "privileged", 
"permissions": { 
"mobileid": { 
"description": "Needed for MSISDN" 
} 
}, 
"name": "My app", 
"description": "My app", 
"launch_path": "/index.html", 
"icons": { 
"16": "/assets/icons/icon16.png", 
"48": "/assets/icons/icon48.png", 
"128": "/assets/icons/icon128.png" 
}, 
"developer": { 
"name": "YasserB.", 
"url": "" 
}, 
"default_locale": "fr" 
} 

我使用的是火狐OS手機ID的權限。

和我使用的代碼來獲取MSISDN

var msisdn = navigator.mozMobileConnection.iccInfo.msisdn; 

我得到一個錯誤:

TypeError: navigator.mozMobileConnection is undefined 
+0

同樣的錯誤,如果你嘗試:'window.navigator.mozMobileConnection.iccInfo.msisdn;'? – R3tep

+0

是的同樣的錯誤,我已經試過 –

回答

1

您沒有使用MobileID API,但MobileConnection一個(其順便說一句,只適用於認證的應用程序)在您的代碼。

添加mobileid權限您的清單,你應該能夠調用navigator.getMobileIdAssertion()。請注意,此API要求用戶接受與您的應用程序共享電話號碼。

+0

謝謝!以及如何獲得MSISDN? –

相關問題