Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm writing an app and I'm trying to incorporate content hub into it.
My app downloads various file formats so I want to be able to export images, videos and other types of content to other apps.
I followed this content hub guide but found it lacking in examples for exporting content.
Anyway, when I'm trying to export any content, the transfer's state always changes to "aborted" immediately and I have no idea why.
Here is my OpenContentPopup component:

PopupBase {
    id: root

    property var activeTransfer
    property var items: []
    property alias contentType: peerPicker.contentType

    Connections {
        target: activeTransfer
        onStateChanged: {
            console.log("Transfer state changed to " + activeTransfer.state)

    ContentPeerPicker {
        id: peerPicker
        handler: ContentHandler.Destination

        onPeerSelected: {
            for (var i = 0; i < items.length; i++) {
                console.log("Sharing item with name: " + items[i].name + ", url: " + items[i].url)

            activeTransfer = peer.request()
            activeTransfer.items = root.items
            activeTransfer.state = ContentTransfer.Charged

        onCancelPressed: {

When I'm trying to export an image the ContentPeerPicker gives me the option to open the Gallery app, but when I select the gallery app the gallery app isn't opened and it appears that the transfer's state is aborted (or 5..).
My logs in the code example give me:

<debug> Sharing item with name: name, url: file:///home/phablet/.local/share/com.nogzatalz.downow/download/Cover.jpg
<debug> Transfer state changed to 5


    "name": "com.nogzatalz.downow",
    "description": "Torrent downloading app",
    "framework": "ubuntu-sdk-14.10-qml-dev3",
    "architecture": "armhf",
    "title": "DowNow",
    "hooks": {
        "downow": {
            "desktop": "downow.desktop",
            "apparmor": "apparmor.json",
            "urls": "urldispatcher.json",
            "content-hub": "content-hub.json"
    "version": "0.1.28",
    "maintainer": "DowNow Support <>"


    "source": [


    "policy_groups": [
    "policy_version": 1.2

I really think we need better error messages..
Any help is appreciated!
Thanks, Tal

share|improve this question
Shouldn't it be activeTransfer.start() ? – user2563892 Aug 15 '14 at 11:26
I see you've taken it out of webbrowser-app – user2563892 Aug 15 '14 at 11:36
Here are the files for the Sharing in webbrowser-app:… – user2563892 Aug 15 '14 at 11:41
Yeah, I did use the ContentShareDialog.qml file from webbrowser-app as a base. Although I can't see what I'm doing wrong here.. – meta221 Aug 15 '14 at 12:56
I tried also adding activeTransfer.start() but that did not help. – meta221 Aug 15 '14 at 12:57

I think the problem is you are trying to charge it before the transfer is ready. Look at this as an example:

share|improve this answer

Apparently the code I shared was correct.
In my main function I had:

setenv("APP_ID", "com.nogzatalz.downow", /*overwrite*/ true);

I guess that messed up app armor..
I only put it there because I used to get errors about APP_ID not being set or something..
Anyway, Thanks for all your help everyone! =)

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.