Hello,
This is my first attempt at asking for help on GG. So please bare with me if I
make any n00b mistakes.
I have tried researching the answer for a few days now, and I have come up
empty handed. So I am a bit lost at what to do now.
I am trying to create an addEventListener for incoming SMS. The aim of the app
is to run commands based upon the sms 'keywords' that are sent to the phone
(aka, ring loud, lock device, turn on wifi, reply to sms with GPS locations).
At the moment I'm just trying to do a simple alert() to display on the app when
a SMS has been received.
I have set up my manifest.webapp to include all the relevant settings.
"type" : "certified",
"permissions": {
"backgroundservice":{},
"sms":{}
},
"messages": [
{ "sms-received": "/index.html" },
{ "notification": "/index.html" }
]
As a side note, I am able to send sms from my app without any issues. So I
assume I have no problem's with my permissions. I've also check to see that I
have full access to mozMobileMessage
I am testing on a Geekphone which I have rooted, and I can install certified
apps.
The code I am trying to use is:
var mozMM = navigator.mozMobileMessage;
mozMM.addEventListener('received', function addEventListener(evt) {
// Display a alert when a message comes in
$window.alert('SMS received');
$window.alert(evt.message.body);
}, false);
I have uploaded the full source code to github:
https://github.com/s3069246/findmydevice/tree/master/app
I hope I've provided all relevant information and posted in the right group.
Sorry if I have left out any important information.
Thanks for your time,
Lau
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g