Created
June 22, 2012 23:15
-
-
Save marshall/2975729 to your computer and use it in GitHub Desktop.
WebSmsIndicator example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This example shows the WIP API in https://bugzilla.mozilla.org/show_bug.cgi?id=736710 | |
// Note: mozSms access requires the URL to be in the dom.sms.whitelist | |
// I tested with the statusbar by adding the "sms" permission category to Gaia's system app in gaia/apps/system/manifest.webapp | |
var sms = window.navigator.mozSms; | |
sms.addEventListener("indicator", function onindicator(event) { | |
var indicator = event.message.indicator; | |
if (indicator.active) { | |
// show indicator | |
} | |
if (indicator.messageCount > 0) { | |
// show message count | |
} | |
// voicemail callback number is in the indicator's owning message: | |
var callbackNumber = event.message.sender; | |
// some older voicemail systems won't give you an exact messageCount, but they can give a "Return Call" message in the SMS message body | |
var returnCallMessage = event.message.body; | |
if (returnCallMessage) { | |
// display return call message | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment