A huge thanks Salva for the solution. It works like a charm!
I was wrapping my head around the issue for ages and now it makes complete
sense. I am extremely grateful.
Thank you!
On Wednesday, August 21, 2013 9:27:28 AM UTC+2, Salvador de la Puente González
wrote:
> Hello
>
>
>
> The problem is in your listener. Let's see in line...
>
>
>
> On 20/08/13 18:57, laubarnes wrote:
>
> > 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" }
>
> > ]
>
> >
>
> Okay here.
>
> > 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);
>
> >
>
> This is wrong, here you need a system message handler:
>
>
>
> navigator.mozSetMessageHandler('sms-received', function onSMS(sms) {
>
> /* here your code */
>
> });
>
>
>
> Use this for any system message you use and remember that, on some APIs
>
> (i.e. alarms), you can only receive the alarm in the same page you
>
> installed it.
>
>
>
> Hope it helps.
>
> Salva.
>
>
>
> ________________________________
>
>
>
> Este mensaje se dirige exclusivamente a su destinatario. Puede consultar
> nuestra política de envío y recepción de correo electrónico en el enlace
> situado más abajo.
>
> This message is intended exclusively for its addressee. We only send and
> receive email on the basis of the terms set out at:
>
> http://www.tid.es/ES/PAGINAS/disclaimer.aspx
_______________________________________________
dev-b2g mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-b2g