Flohack last edited by
@Craig 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 ?
Hi, and good job on this.
Now you want to use the content hub the other way around and export a picture from your app.
You'll have to add
ContentHandler.Sourceto your SDLTest-contenthub.json
You should read this : http://docs.ubports.com/en/latest/appdev/guides/contenthub.html#exporting
As Flo wrote, you cannot force an app, the user has to select the destination app.
@Flohack What about when the Messaging app launches the content hub so I can attach an image to a text message?
What Florian meant is that an app cannot directly opens another one (even less a specific one).
You have to go through the Content Hub to do so, but it's not the messaging app opening the gallery...
@AppLee 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.
@AppLee 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!
Oh sorry, I ddin't fully understand your question.
So you can refer there : http://docs.ubports.com/en/latest/appdev/guides/contenthub.html#importing
You can call the
ContentPeerPickerin your code to display the app choice to import a Picture from.
@AppLee 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++.
Yes it's QML, I don't know about C++ only.
Can you consider some QML for the front part of your app ?
It's not difficult to learn and use.
@AppLee Okay, I tried it. I did "clickable create" and selected the C++ binary option.
When I run "clickable" the main.cpp file calls qml/Main.qml and it says "Hello World!" on my touch device.
Now, I tried to swap the code in Main.qml for this code here:
The code just below "Example usage for importing content:"
When I run "clickable", clickable reports: /bin/sh: 1: Syntax error: "(" unexpected
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?