Reputation: 26940
I searched here for sms api, but could not find anything. Is it even possible to send/read sms messages on Firefox OS?
Upvotes: 1
Views: 649
Reputation: 1119
Yes you can send sms on firefox OS, but as there is high-impact security implications before using sms api in manifest.webapp file you have to edit type field as "type": "certified" and in the permission field you have to add "sms":{}.
After that to send sms you can use following code
var message = "hi"; //sms content
var number = "0191147689"; //mobile no you want to send sms
var request;
try{
request = navigator.mozMobileMessage.send(number, message);
}
catch(error){
console.log(error.name + " occured while sending sms");
}
request.onsuccess = function(){
console.log("SMS has been sent");
}
request.onerror = function(){
console.log("Something went wrong: " + this.error);
}
Upvotes: 0
Reputation: 578
Because of its high-impact security implications, the WebSMS API currently is only available for certified applications on Firefox OS (see WebSMS on MDN).
Certified applications are the ones included in the operating system itself, so - as a third party developer - at the moment you can not create applications that can use this Web API. Accessing the SMS API is a much requested feature, though, so there is work going on to make this possible in the OS on the long term, but not in the near future.
Upvotes: 2
Reputation: 26940
Api docs is available here:
navigator.mozSetMessageHandler('sms-received', function(sms){
});
EDIT: Sending, deleting, mark as read...
Upvotes: 0