Get user's phone number in Firefox operating system

Is there a way to get users' phone number in Firefox OS?

If so, any help would be appreciated.

+3


source to share


3 answers


According to Mozilla's app permission pages , there is a permission called "phonenumberservice", but there is no information about it. In any case, the permission is listed under "Internal (Certified) Application Permissions", which means it can only be used by "system-level and default applications created by Mozilla / carriers / OEMs" whenever possible.



+3


source


With Firefox 2.0 you will be able to use the Mobile Identity API: https://wiki.mozilla.org/WebAPI/MobileIdentity https://bugzilla.mozilla.org/show_bug.cgi?id=1021594 I believe the permission is:

"Permissions": {"mobileid": {}}



And this is a privilege.

+2


source


So, as Jason said, the Mobile Identity API provides this capability, not just for certified but privileged applications. So it's not just for OEMs anymore.

The Mozilla Wiki site shows the API:

dictionary MobileIdOptions {
    boolean forceSelection = false;
};
partial interface Navigator {
    Promise getMobileIdAssertion(optional MobileIdOptions options);
};

      

The site also provides an example of a skeleton code:

function verifyAssertion(aAssertion) {
    // Make use of the remote verification API
    // and return the verified msisdn.
    // NB: This is necessary to make sure that the user *really* controls this phone number!
}

// Request a mobile identity assertion and force the chrome UI to
// allow the user to change a possible previous selection.
navigator.getMobileIdAssertion({ forceSelection: true })
.then(
    (assertion) => {
        verifyAssertion(assertion)
        .then(
            (msisdn) => {
                // Do stuff with the msisdn.
            }
        );
    },
    (error) {
        // Process error.
    };
);

      

To do this, you need to add permission mobileid

to the manifest file, for example like this (I made up the description):

"permissions": {
    "mobileid": {
        "description": "Required for sending SMS for two factor authentication",
        "access": "readonly"
    }
}

      

PS: I made this answer because most of the answers are out of date and the one that is not does not contain all the useful information.

Literature:

+1


source







All Articles