When trying to open a file using content hub using C++ I get these errors:

Opening with peer com.ubuntu.music_music_2.1.857
Sdk-Launcher> Application was resumed
Sdk-Launcher> There has been a AppArmor denial for your application.
Sdk-Launcher> Most likely it is missing a policy in the AppArmor file.
Syslog> Jun 20 19:15:23 ubuntu-phablet kernel: [ 3561.148570] type=1400 audit(1434827723.595:155): apparmor="DENIED" operation="open" profile="com.nogzatalz.downow_downow_0.8.81" name="/home/phablet/.local/share/applications/com.ubuntu.music_music_2.1.857.desktop" pid=9282 comm="downow" requested_mask="r" denied_mask="r" fsuid=32011 ouid=32011
transfer state changed to 5
Sdk-Launcher> Application was focused
transfer state changed to 5
transfer state changed to 5

I checked in the Transfer::State enum and found that state 5 means aborted.
This is my apparmor.json file:

{
    "policy_groups": [
        "networking",
        "content_exchange",
        "content_exchange_source",
        "audio"
    ],
    "policy_version": 1.3
}

I'm using the ubuntu-sdk-15.04-qml framework.
My app worked fine until the last OTA update. On my Nexus 5 this is r20.
Any help is appreciated!

EDIT: After trying to solve this problem for a while, I noticed that I'm able to import content from other applications, but exporting still doesn't seem to work.
Here is my simplified code for importing (which works):

QPointer<cuc::Hub> hub = cuc::Hub::Client::instance();
cuc::Peer peer = hub->default_source_for_type(cuc::Type::Known::pictures());
cuc::Transfer * t = hub->create_import_from_peer(peers);
t->start();

Here is my simplified code for exporting (which doesn't work):

 QPointer<cuc::Hub> hub = cuc::Hub::Client::instance();
 QVector<cuc::Peer> peers = hub->known_destinations_for_type(cuc::Type::Known::pictures());
 cuc::Transfer * t = hub->create_export_to_peer(peers[0]);
 QVector<cuc::Item> items;
 items.append(cuc::Item(QUrl::fromLocalFile("/home/phablet/.local/share/com.nogzatalz.downow/download/Ed Sheeran – 5 (2015) (ALBUM) 320 KBPS/Cover.jpg")));
 t->setSelectionType(cuc::Transfer::single);
 t->charge(items);
share|improve this question

In my manifest.json, I had to add a property called content-hub to hooks:

"content-hub": "hub.json"

And then create a hub.json file:

{
    "source": [ "pictures" ]
}
share|improve this answer
    
As I understand it you only need to add a content hub file if you want other apps to be able to import or export to your app. You don't need it to import from or export to other apps. Anyway, I tried to add it and it didn't make a difference. – meta221 Jun 24 '15 at 19:55

Your Answer

 
discard

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.