We have moved to a new Sailfish OS Forum. Please start new discussions there.
24

Is there any social sharing API?

asked 2014-01-22 15:46:17 +0300

juke gravatar image

updated 2014-01-22 16:31:41 +0300

eric gravatar image

In Browser you can share links and in Gallery let's you share photos. Is there some unified way to do that?

In Android you can just

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "This is my text to send.");
sendIntent.setType("text/plain");
startActivity(sendIntent);

and a sharing menu will open up. Is there anything like this?

edit retag flag offensive close delete

Comments

2 Answers

Sort by » oldest newest most voted
5

answered 2015-03-24 09:40:06 +0300

chris.adams gravatar image

updated 2017-11-04 16:34:07 +0300

pawel gravatar image

Just import Sailfish.Silica and Sailfish.TransferEngine, then show a ShareMethodList in a page in your application:

ShareMethodList {
    anchors.fill: parent
    header: PageHeader {
        title: "Share All The Things!"
    }
    content: {
        "name": "remote_filename",
        "data": someByteArrayOrText,
        "type": someMimeType, // eg "text/x-vnote"
        "icon": someFileTypeIcon
    }
    filter: type // filter share plugins based on mime type

    ViewPlaceholder {
        enabled: methodlist.count == 0
        text: "No sharing plugins installed which can share that mime type!"
    }
}

Hope this helps! For more information about the sharing engine stuff, see: old: https://github.com/nemomobile/transfer-engine

new: https://git.merproject.org/mer-core/transfer-engine

But note that the code there is just the framework/engine, whereas the other two important parts (the share plugins and the sharing UI components) are closed source currently. Of course, anyone is welcome to write their own share plugins, and the UI components aren't black magic, they just call various methods of the sharing engine via DBus API.

Cheers, Chris.

edit flag offensive delete publish link more

Comments

1

Is Sailfish.TransferEngine allowed in Harbour?

donaggio ( 2015-03-31 10:13:38 +0300 )edit
0

answered 2017-11-04 08:32:29 +0300

pawel gravatar image

updated 2017-11-04 19:13:31 +0300

any update on this?

would like to add sharing into my apps. to share something from app is obviously simple: the code above still works. but how can i consume shared data ? means become a sharing plugin ?

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
9 followers

Stats

Asked: 2014-01-22 15:46:17 +0300

Seen: 632 times

Last updated: Nov 04 '17