web apis
unleashing the power of open web apps
Web (apps) today
this is unstoppable...
... but let's do it right
HANDS-ON: my OWN SMS APP
Manifest:
{
"name": "My SMS app",
"description": "App to send SMS messages.",
"icons": {
"128": "/icons/SMS-icon.png"
},
"type": "certified",
"permissions": {
"sms": {}
}
}
HTML:
<input id="number" type="text" placeholder="666666666"> <br/>
<textarea id="text" placeholder="Type your text..."></textarea> <br/>
<button id="send"> Send </button>
Javascript:
var sms = navigator.mozMobileMessage;
sms.send(number.value, text.value);
SMS app manifest:
"activities": {
"new": {
"href": "/index.html#activity-new",
"filters": {
"type": "websms/sms",
"number": {
"pattern":"[\\w\\s+#*().-]{0,50}"
}
},
"disposition": "inline",
"returnValue": true
}
}
Activity invocation code:
var activity = new MozActivity({
name: 'new',
data: {
type: 'websms/sms',
number: number
}
});