I'm developing an app for FirefoxOS. This app needs a button that, when pressed, shares some text in social networks and email.
I'm using this code I found somewhere:
var share = document.querySelector("#share");
if (share)
{
share.onclick = function ()
{
var sharing = new MozActivity({
name: "share",
data:
{
//type: "url", // Possibly text/html in future versions,
number: 1,
url: "http://robertnyman.com"
}
});
}
}
It kind of works and I successfully shared pictures. This code opens a menu with all the apps that are available for sharing (Facebook, Twitter, etc). Then you can select any app and it will open that app with an empty textfield that the user can fill with text to share. But I cannot share predefined text at all. I cannot pass this predefined text to the other apps.
As you can see, there's a type parameter that's commented and it says that it'll be available in future versions.
Do you guys have any idea of how to include text in the data variable (or somewhere else) so it can be shared?
Thanks everyone!