Search code examples
javascriptfirefox-os

Strange behaviour of WebActivities under Firefox OS 1.2


I am writting a firefox os application and I found a strange problem. I have two web activities (open a link on a projects tab and sending an e-mail on the users tab ) what are work correctly under the Firefox OS 1.1 simulator but not work under the appmanager+firefox OS 1.2 simulator. In additional it did not work under my Keon phone with FFOS 1.2 prerelease.

Do you have any idea? Thanks.


Solution

  • Might not be the most optimal way but try something like:

    function sendEmail(toEmail, subject, body) {
      var createEmail = new MozActivity({
        name : "new",
        data : {
          type : "mail",
          url : "mailto:" + toEmail + "?&subject=" + subject + "&body=" + body + "",
        }
      });
    }
    function processUsers() {
        if (xhr.readyState == 4 && xhr.status == 200) {
          var obj = jQuery.parseJSON(xhr.responseText);
          for (var i = 0; i < obj['users'].length; i++) {
            if (obj['users'][i].email != null) {
                var myLi = document.createElement('li');
                myLi.innerHTML = "<p>" + obj['users'][i].name+ "</p>" + "<p class='sendEmail'>" + obj['users'][i].email; "</p>";
                var em =obj['users'][i].email;
                var sb = '';
                var bd = '';
                myLi.onclick = (function(em, sb, bd) {
                    return function(){ sendEmail(em, sb, bd) }
                })(em, sb, bd);
              $('#resultsUsers').append(myLi);
            } else {
              $('#resultsUsers').append("<li><p>" + obj['users'][i].name + "</p></li>");
            }
          }
          usersAreLoaded = true;
        } else {
          console.log("did not get data " + xhr.status);
        }
    }