share.js 984 B

1234567891011121314151617181920
  1. function shareMeNow(message, subject, url) {
  2. // this is the complete list of currently supported params you can pass to the plugin (all optional)
  3. var options = {
  4. message: message || '', // not supported on some apps (Facebook, Instagram)
  5. subject: subject || 'Share this:', // fi. for email
  6. //files: ['', ''], // an array of filenames either locally or remotely
  7. url: url || 'https://www.ecn.org/xm24',
  8. };
  9. var onSuccess = function(result) {
  10. console.log("Share completed? " + result.completed); // On Android apps mostly return false even while it's true
  11. console.log("Shared to app: " + result.app); // On Android result.app is currently empty. On iOS it's empty when sharing is cancelled (result.completed=false)
  12. };
  13. var onError = function(msg) {
  14. console.log("Sharing failed with message: " + msg);
  15. };
  16. window.plugins.socialsharing.shareWithOptions(options, onSuccess, onError);
  17. }