Hi Sushant,

Thank you for trying Crosswalk.

Base on https://crosswalk-project.org/jira/browse/XWALK-53 and our test 
results, the W3C Messaging API is not fully implemented for Crosswalk project 
on Android, so we can’t make sure all the APIs work.

If you still want to use SMS relevant features, I suggest to use relevant 
Cordova plugin base on Crosswalk. For Apache Cordova Android 4.0.0,  it adds 
first-class support for Crosswalk – a bundled modern WebView.

$ npm install -g cordova
$ cordova create hello com.example.hello HelloWorld
$ cd hello
$ cordova platform add android

$ cordova plugin add  cordova-plugin-crosswalk-webview
$ cordova plugin add com.rjfun.cordova.sms

Update js code:
  document.addEventListener('onSMSArrive', function(e){
      var sms = e.data;
      smsList.push( sms );
      updateStatus('SMS arrived, count: ' + smsList.length );
      // sms.address
      // sms.body
      var divdata = $('div#data');
      divdata.html( divdata.html() + JSON.stringify( sms ) );
  });

$ cordova build android
$ cordova run android

More information:
http://cordova.apache.org/docs/en/5.0.0/guide_cli_index.md.html#The%20Command-Line%20Interface

Support for pluggable WebViews!
Crosswalk can be added by installing the cordova-plugin-crosswalk-webview 
plugin.
http://cordova.apache.org/announcements/2015/04/15/cordova-android-4.0.0.html

cordova-plugin-sms Quick Start and API Overview
         http://plugins.cordova.io/#/package/com.rjfun.cordova.sms
https://github.com/floatinghotpot/cordova-plugin-sms/tree/master/docs

Other similar plugins:
         http://plugins.cordova.io/#/package/com.jsmobile.plugins.sms
         http://plugins.cordova.io/#/package/com.cordova.plugins.sms

BR
Belem

From: Crosswalk-help 
[mailto:[email protected]] On Behalf Of 
sushant k
Sent: Monday, May 18, 2015 7:00 AM
To: [email protected]
Subject: [Crosswalk-help] Fwd: Unable to listen to incoming SMS



Hi,

I am trying to listen to incoming SMS using the example code from 
http://www.w3.org/2012/sysapps/messaging/



navigator.setMessageHandler ('received', onMessageReceived)

function onMessageReceived(message) {

  if (message.type == 'sms') {

      window.console.log('SMS Message from ' +

                               message.from + ' received');

   }



}
I am getting: Uncaught TypeError: undefined is not a function error on calling 
navigator.setMessageHandler

Manifest File:

{

  "name": "***",

  "manifest_version": 1,

  "version": "0.1",

  "app": {

    "launch":{

      "local_path": "index.html"

    }

  },

  "xwalk_permissions": [

    "Contacts",

    "Geolocation",

    "Messaging",

    "Vibration"

  ]

}
I am very new to crosswalk. I might be doing something wrong here.

Thanks in advance :-)

-sushant

_______________________________________________
Crosswalk-help mailing list
[email protected]
https://lists.crosswalk-project.org/mailman/listinfo/crosswalk-help

Reply via email to