1

我正在为 Firefox OS 开发一个 Web 应用程序,我需要获取 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"
}

我正在使用 firefox OS Mobile id 权限。

我正在使用该代码获取 MSISDN

var msisdn = navigator.mozMobileConnection.iccInfo.msisdn;

我收到一个错误:

TypeError: navigator.mozMobileConnection is undefined
4

1 回答 1

1

您没有在代码中使用MobileID API,而是MobileConnection之一(顺便说一句,仅适用于经过认证的应用程序)。

mobileid权限添加到您的清单中,您应该可以调用navigator.getMobileIdAssertion(). 请注意,此 API 要求用户接受与您的应用程序共享电话号码。

于 2015-05-13T12:40:00.093 回答