<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[apparmor picture_files_read]]></title><description><![CDATA[<p dir="auto">I'm working on an app that needs permissions to access the user's Pictures directory. I'm programming with C++ and SDL. I set this in my apparmor file:</p>
<p dir="auto">{<br />
"policy_groups": [<br />
"audio",<br />
"picture_files_read"<br />
],<br />
"policy_version": 16.04<br />
}</p>
<p dir="auto">I am able to access the app's directory here:<br />
/home/phablet/.local/share/appname.craig/<br />
I can read and write to that directory.</p>
<p dir="auto">However, I am not able to read files from this directory:<br />
/home/phablet/Pictures</p>
<p dir="auto">Is there something I have over looked?</p>
<p dir="auto">Thank you for your help.</p>
]]></description><link>https://forums.ubports.com/topic/3884/apparmor-picture_files_read</link><generator>RSS for Node</generator><lastBuildDate>Sat, 07 Mar 2026 18:32:28 GMT</lastBuildDate><atom:link href="https://forums.ubports.com/topic/3884.rss" rel="self" type="application/rss+xml"/><pubDate>Sat, 29 Feb 2020 04:15:51 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to apparmor picture_files_read on Wed, 01 Apr 2020 23:25:31 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/applee" aria-label="Profile: AppLee">@<bdi>AppLee</bdi></a> Okay, I tried it. I did "clickable create" and selected the C++ binary option.</p>
<p dir="auto">When I run "clickable" the main.cpp file calls qml/Main.qml and it says "Hello World!" on my touch device.</p>
<p dir="auto">Now, I tried to swap the code in Main.qml for this code here:<br />
<a href="https://api-docs.ubports.com/sdk/apps/qml/Ubuntu.Content/ContentHub.html" rel="nofollow ugc">https://api-docs.ubports.com/sdk/apps/qml/Ubuntu.Content/ContentHub.html</a><br />
The code just below "Example usage for importing content:"</p>
<p dir="auto">When I run "clickable", clickable reports: /bin/sh: 1: Syntax error: "(" unexpected</p>
<p dir="auto">Is there a mistake in the documented code? What do I need to put in the Main.qml file so it brings up the content hub?</p>
<p dir="auto">Thanks!</p>
]]></description><link>https://forums.ubports.com/post/30474</link><guid isPermaLink="true">https://forums.ubports.com/post/30474</guid><dc:creator><![CDATA[Craig]]></dc:creator><pubDate>Wed, 01 Apr 2020 23:25:31 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 09:08:45 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craig" aria-label="Profile: Craig">@<bdi>Craig</bdi></a><br />
Yes it's QML, I don't know about C++ only.<br />
Can you consider some QML for the front part of your app ?<br />
It's not difficult to learn and use.</p>
]]></description><link>https://forums.ubports.com/post/29866</link><guid isPermaLink="true">https://forums.ubports.com/post/29866</guid><dc:creator><![CDATA[AppLee]]></dc:creator><pubDate>Thu, 12 Mar 2020 09:08:45 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 08:59:01 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/applee" aria-label="Profile: AppLee">@<bdi>AppLee</bdi></a> I read that Importing section, thanks. What language is that written in? Qml? My app is written in C++. Is there a way to open the content hub with C++? Or is there some headers I can put in my C++ program that will enable a new function to do that? I can't seem to find documentation for C++.</p>
]]></description><link>https://forums.ubports.com/post/29864</link><guid isPermaLink="true">https://forums.ubports.com/post/29864</guid><dc:creator><![CDATA[Craig]]></dc:creator><pubDate>Thu, 12 Mar 2020 08:59:01 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 08:51:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craig" aria-label="Profile: Craig">@<bdi>Craig</bdi></a><br />
Oh sorry, I ddin't fully understand your question.</p>
<p dir="auto">So you can refer there : <a href="http://docs.ubports.com/en/latest/appdev/guides/contenthub.html#importing" rel="nofollow ugc">http://docs.ubports.com/en/latest/appdev/guides/contenthub.html#importing</a><br />
You can call the <code>ContentPeerPicker</code> in your code to display the app choice to import a Picture from.</p>
]]></description><link>https://forums.ubports.com/post/29862</link><guid isPermaLink="true">https://forums.ubports.com/post/29862</guid><dc:creator><![CDATA[AppLee]]></dc:creator><pubDate>Thu, 12 Mar 2020 08:51:27 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 08:45:21 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/applee" aria-label="Profile: AppLee">@<bdi>AppLee</bdi></a> Sorry, I must not be using the right vocabulary. Basically, like how the Messaging app opens the content hub and you can choose from Gallery or File Manager, then a photo is sent to a directory where the Messaging app can access it. How can I get my C++ app to open/launch/etc the content hub? I have already added the required code for my app to be listed as a "destination" in the content hub. I just need to understand how to create an event/link/etc in C++ that will open the content hub for my app's users. Thank you!</p>
]]></description><link>https://forums.ubports.com/post/29861</link><guid isPermaLink="true">https://forums.ubports.com/post/29861</guid><dc:creator><![CDATA[Craig]]></dc:creator><pubDate>Thu, 12 Mar 2020 08:45:21 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 08:39:52 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/applee" aria-label="Profile: AppLee">@<bdi>AppLee</bdi></a> Why would I want to export a picture from my app when that's not what it needs to do? It needs to acquire a picture from the content hub, namely Gallery or File Manager. Sorry, maybe I didn't make it clear what I'm trying to do.</p>
]]></description><link>https://forums.ubports.com/post/29860</link><guid isPermaLink="true">https://forums.ubports.com/post/29860</guid><dc:creator><![CDATA[Craig]]></dc:creator><pubDate>Thu, 12 Mar 2020 08:39:52 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 08:38:55 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craig" aria-label="Profile: Craig">@<bdi>Craig</bdi></a><br />
What Florian meant is that an app cannot directly opens another one (even less a specific one).<br />
You have to go through the Content Hub to do so, but it's not the messaging app opening the gallery...</p>
]]></description><link>https://forums.ubports.com/post/29859</link><guid isPermaLink="true">https://forums.ubports.com/post/29859</guid><dc:creator><![CDATA[AppLee]]></dc:creator><pubDate>Thu, 12 Mar 2020 08:38:55 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 08:36:13 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/flohack" aria-label="Profile: Flohack">@<bdi>Flohack</bdi></a> What about when the Messaging app launches the content hub so I can attach an image to a text message?</p>
]]></description><link>https://forums.ubports.com/post/29857</link><guid isPermaLink="true">https://forums.ubports.com/post/29857</guid><dc:creator><![CDATA[Craig]]></dc:creator><pubDate>Thu, 12 Mar 2020 08:36:13 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 08:24:20 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craig" aria-label="Profile: Craig">@<bdi>Craig</bdi></a><br />
Hi, and good job on this.<br />
Now you want to use the content hub the other way around and export a picture from your app.</p>
<p dir="auto">You'll have to add <code>ContentHandler.Source</code> to your SDLTest-contenthub.json<br />
You should read this : <a href="http://docs.ubports.com/en/latest/appdev/guides/contenthub.html#exporting" rel="nofollow ugc">http://docs.ubports.com/en/latest/appdev/guides/contenthub.html#exporting</a></p>
<p dir="auto">As Flo wrote, you cannot force an app, the user has to select the destination app.</p>
]]></description><link>https://forums.ubports.com/post/29856</link><guid isPermaLink="true">https://forums.ubports.com/post/29856</guid><dc:creator><![CDATA[AppLee]]></dc:creator><pubDate>Thu, 12 Mar 2020 08:24:20 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 07:45:15 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craig" aria-label="Profile: Craig">@<bdi>Craig</bdi></a> I dont think that its supported for an App to launch another app. You could export a picture and then the suer canchoose Gallery as a target. But so far just launching a specific app is not possible. Its also hard to make this stable since what if Gallery app is not installed, has been renamed etc ?</p>
]]></description><link>https://forums.ubports.com/post/29855</link><guid isPermaLink="true">https://forums.ubports.com/post/29855</guid><dc:creator><![CDATA[flohack]]></dc:creator><pubDate>Thu, 12 Mar 2020 07:45:15 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Thu, 12 Mar 2020 05:38:59 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/applee" aria-label="Profile: AppLee">@<bdi>AppLee</bdi></a> I'm getting my C++/SDL app to receive pictures from the content hub as you suggested. I hope this can serve as a half-way tutorial for others out there. But it's not complete. Here is what I have so far:</p>
<p dir="auto">In my manifest.json, I have "content-hub" in the hooks section:</p>
<pre><code>"hooks": {
	"SDLTest": {
		"apparmor": "SDLTest.apparmor",
		"desktop": "SDLTest.desktop",
		"content-hub": "SDLTest-contenthub.json"
	}
</code></pre>
<p dir="auto">In SDLTest-contenthub.json I have "pictures":</p>
<p dir="auto">{<br />
"destination": [<br />
"pictures"<br />
]<br />
}</p>
<p dir="auto">In SDLTest.apparmor I have "content_exchange":</p>
<p dir="auto">{<br />
"policy_groups": [<br />
"audio",<br />
"content_exchange"<br />
],<br />
"policy_version": 16.04<br />
}</p>
<p dir="auto">After I run "clickable", I open the Gallery app, select a photo and click on the link icon, I see my app listed. After I selected my app, I used "adb shell" and found the photo I selected on my phone at this system path:<br />
/home/phablet/.cache/sdltest.craig/HubIncoming/18</p>
<p dir="auto">And I had read/write access to the photos with C++. This part works great so far!</p>
<p dir="auto">But all I need to understand now is how to I get my app to LAUNCH Gallery when a user clicks a button inside my app. I'm using purely C++ and SDL. I imagine it would work something like this:</p>
<p dir="auto">if ( event.type == SDL_FINGERDOWN ) {<br />
SomeFunctionHere(LaunchGallery);<br />
}</p>
<p dir="auto">Detailed instructions would be appreciated. You wont bore me.</p>
]]></description><link>https://forums.ubports.com/post/29849</link><guid isPermaLink="true">https://forums.ubports.com/post/29849</guid><dc:creator><![CDATA[Craig]]></dc:creator><pubDate>Thu, 12 Mar 2020 05:38:59 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Sat, 07 Mar 2020 19:31:22 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craig" aria-label="Profile: Craig">@<bdi>Craig</bdi></a> have you tried Telegram AppDev group ?, or maybe create a new topic for this issue</p>
]]></description><link>https://forums.ubports.com/post/29602</link><guid isPermaLink="true">https://forums.ubports.com/post/29602</guid><dc:creator><![CDATA[lduboeuf]]></dc:creator><pubDate>Sat, 07 Mar 2020 19:31:22 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Sat, 07 Mar 2020 13:56:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/applee" aria-label="Profile: AppLee">@<bdi>AppLee</bdi></a> Thank you. I read those pages before and I read them again. I added hooks in my manifest.json and a contenthub.json file. I see my app listed when I open Gallery, select a photo and click the share icon.</p>
<p dir="auto">I'm programming my app in C++ and SDL2. So my question is: How can I get my app to open the content hub so a user can select a photo from their Gallery?</p>
]]></description><link>https://forums.ubports.com/post/29573</link><guid isPermaLink="true">https://forums.ubports.com/post/29573</guid><dc:creator><![CDATA[Craig]]></dc:creator><pubDate>Sat, 07 Mar 2020 13:56:35 GMT</pubDate></item><item><title><![CDATA[Reply to apparmor picture_files_read on Sat, 29 Feb 2020 09:22:06 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/craig" aria-label="Profile: Craig">@<bdi>Craig</bdi></a> Hi Craig,</p>
<p dir="auto">Short answer, please read this page :<br />
<a href="http://docs.ubports.com/en/latest/appdev/platform/apparmor.html#picture-files-read" rel="nofollow ugc">http://docs.ubports.com/en/latest/appdev/platform/apparmor.html#picture-files-read</a></p>
<blockquote>
<p dir="auto">Developers should typically use the content_exchange policy group and API to access picture files instead</p>
</blockquote>
<p dir="auto">You might want to use :<br />
<a href="http://docs.ubports.com/en/latest/appdev/guides/contenthub.html" rel="nofollow ugc">http://docs.ubports.com/en/latest/appdev/guides/contenthub.html</a></p>
<p dir="auto">I don't know about how to use the reserved rights but I'll advise to follow the common rules and use the content hub.</p>
]]></description><link>https://forums.ubports.com/post/29274</link><guid isPermaLink="true">https://forums.ubports.com/post/29274</guid><dc:creator><![CDATA[AppLee]]></dc:creator><pubDate>Sat, 29 Feb 2020 09:22:06 GMT</pubDate></item></channel></rss>