Deployment on BlackBerry: Difference between revisions

From Qt Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
=Deployment on BlackBerry 10=
[[Category:BlackBerry]]
 
= Deployment on BlackBerry 10 =


This article explains various details about deployment on BlackBerry 10 for Qt developers. Generally, this topic is well explained in the BlackBerry 10 documentation for native application development. In this article, you will find some additional details and tips specific for Qt development.
This article explains various details about deployment on BlackBerry 10 for Qt developers. Generally, this topic is well explained in the BlackBerry 10 documentation for native application development. In this article, you will find some additional details and tips specific for Qt development.


==Start with BlackBerry 10 docs==
== Start with BlackBerry 10 docs ==


It is good to get an overview first if you are new to a platform. Please read the following overview articles in the BlackBerry 10 documentation:
It is good to get an overview first if you are new to a platform. Please read the following overview articles in the BlackBerry 10 documentation:<br />* &quot;Developing apps&amp;quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_stub_app_creation_process.html and all articles in that section.<br />* &quot;The BAR application descriptor file &quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_about_bar_app_descriptor_file.html and &quot;App permissions&amp;quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_appfund_accessing_restricted_functionality.html<br />* &quot;App Life Cycle&amp;quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_appfund_applifecycle.html<br />* &quot;Working with the file system&amp;quot;:https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html. This article also explains how standard Qt paths, e.g. &lt;code&amp;gt;QDir::homePath()&lt;code&amp;gt; are mapped to the file system.<br />* &quot;Using low-level functionality&amp;quot;:https://developer.blackberry.com/native/documentation/core/rtos.html


* [https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_stub_app_creation_process.html Developing apps] ''[developer.blackberry.com]'' and all articles in that section.
== Application packaging ==
* [https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_about_bar_app_descriptor_file.html The <span class="caps">BAR</span> application descriptor file] ''[developer.blackberry.com]'' and [https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_appfund_accessing_restricted_functionality.html App permissions] ''[developer.blackberry.com]''
* [https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_appfund_applifecycle.html App Life Cycle] ''[developer.blackberry.com]''
* [https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html Working with the file system] ''[developer.blackberry.com]''. This article also explains how standard Qt paths, e.g. <code>QDir::homePath()<code> are mapped to the file system.</code></code>
* [https://developer.blackberry.com/native/documentation/core/rtos.html Using low-level functionality] ''[developer.blackberry.com]''


==Application packaging==
The page &quot;Packaging, deployment and distribution&amp;quot;:https://developer.blackberry.com/native/documentation/core/qt_package_deploy.html is a good introduction to the tools and how to use them.<br />In short, applications are packaged in so called '''BAR files''' which are zip archives with additional meta information.


The page [https://developer.blackberry.com/native/documentation/core/qt_package_deploy.html Packaging, deployment and distribution] ''[developer.blackberry.com]'' is a good introduction to the tools and how to use them.<br /> In short, applications are packaged in so called '''<span class="caps">BAR</span> files''' which are zip archives with additional meta information.
=== Blackberry Application aRchive (BAR) descriptor file ===


===Blackberry Application aRchive (<span class="caps">BAR</span>) descriptor file===
A part of this meta information is the content of the &quot;BAR application descriptor file&amp;quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_about_bar_app_descriptor_file.html which is an '''XML''' file. This file describes the content of the package and where this content can be found. This file defines other important meta information as well, but this is less relevant to this article.


A part of this meta information is the content of the [https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_about_bar_app_descriptor_file.html <span class="caps">BAR</span> application descriptor file] ''[developer.blackberry.com]'' which is an '''<span class="caps">XML</span>''' file. This file describes the content of the package and where this content can be found. This file defines other important meta information as well, but this is less relevant to this article.
Qt Creator has an editor for the BAR application descriptor files which simplifies quite some manual editing.
 
Qt Creator has an editor for the <span class="caps">BAR</span> application descriptor files which simplifies quite some manual editing.


The content of the package may also include images, sounds and any other data files used by the application in addition the the binary.
The content of the package may also include images, sounds and any other data files used by the application in addition the the binary.


See [https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/r_blackberry_tablet_dtd_intro.html full list of all elements in a <span class="caps">BAR</span> application descriptor file] ''[developer.blackberry.com]''
See &quot;full list of all elements in a BAR application descriptor file&amp;quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/r_blackberry_tablet_dtd_intro.html


===blackberry-nativepackager===
=== blackberry-nativepackager ===


Application packages are created by the command line tool <code>blackberry-nativepackager<code> provided in the BlackBerry 10 <span class="caps">NDK</span>. This tool reads a <span class="caps">BAR</span> application descriptor file passed as an argument and builds the application package accordingly.</code></code>
Application packages are created by the command line tool &lt;code&amp;gt;blackberry-nativepackager&amp;lt;code&amp;gt; provided in the BlackBerry 10 NDK. This tool reads a BAR application descriptor file passed as an argument and builds the application package accordingly.


Application packages can be built in a development mode or can be built as signed packaged. Development mode applications require a '''debug token''' and can be installed and run on any device with the same debug token as they were build with.
Application packages can be built in a development mode or can be built as signed packaged. Development mode applications require a '''debug token''' and can be installed and run on any device with the same debug token as they were build with.
Line 35: Line 31:
Signed packaged are usually used for publishing in BlackBerry World. They can also be installed from the command line on any device in development mode and do no need a debug token.
Signed packaged are usually used for publishing in BlackBerry World. They can also be installed from the command line on any device in development mode and do no need a debug token.


See the full article about [http://developer.blackberry.com/native/documentation/core/qt_package_deploy.html Packaging, deployment and distribution] ''[developer.blackberry.com]''
See the full article about &quot;Packaging, deployment and distribution&amp;quot;:http://developer.blackberry.com/native/documentation/core/qt_package_deploy.html


==Where do the app resources land on the device==
== Where do the app resources land on the device ==


===Handling the sand box===
=== Handling the sand box ===


Each application is installed in its own home folder on a dedicated partition. Shared folders (those which contain data to be shared between apps) are mapped according to permissions requested so that the app can access them under the standard paths. An important thing to keep in mind is that all applications can access files only within the boundaries of their “sandboxes”. When the app asks to access shared data, according folders become available in app’s sandbox as well. See [https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html Working with the file system] ''[developer.blackberry.com]'' for an overview of all sub-folders for different purposes in app’s home folder.
Each application is installed in its own home folder on a dedicated partition. Shared folders (those which contain data to be shared between apps) are mapped according to permissions requested so that the app can access them under the standard paths. An important thing to keep in mind is that all applications can access files only within the boundaries of their &quot;sandboxes&amp;quot;. When the app asks to access shared data, according folders become available in app's sandbox as well. See &quot;Working with the file system&amp;quot;:https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html for an overview of all sub-folders for different purposes in app's home folder.


Applications cannot directly access any files outside their sandboxes. Even though it is possible to package and deploy libraries with the application, it is not possible to deploy any libraries into the system folders. Applications cannot share their libraries with other applications either.
Applications cannot directly access any files outside their sandboxes. Even though it is possible to package and deploy libraries with the application, it is not possible to deploy any libraries into the system folders. Applications cannot share their libraries with other applications either.


===Packaging and accessing the files===
=== Packaging and accessing the files ===
 
Even though the article &quot;Working with the file system&amp;quot;:https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html explains how the sandbox model influences file access, it might be clear from the beginning how paths can actually be referred in the application code.
 
Lets assume you have an app which loads an image with Qt Quick . The application code is located in the subfolder &quot;test_assets&amp;quot; in your &quot;projects&amp;quot; folder. The first thing you have to take care of is to add this image to the BAR application descriptor file:


Even though the article [https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html Working with the file system] ''[developer.blackberry.com]'' explains how the sandbox model influences file access, it might be clear from the beginning how paths can actually be referred in the application code.
<code><br /> &lt;asset path=&quot;/Users/johndoe/projects/test_assets/qt-logo.png&amp;quot;&gt;qt-logo.png&amp;lt;/asset&amp;gt;<br /></code>


Lets assume you have an app which loads an image with Qt Quick . The application code is located in the subfolder “test_assets” in your “projects” folder. The first thing you have to take care of is to add this image to the <span class="caps">BAR</span> application descriptor file:
This line is the universal way to add any other &quot;stuff&amp;quot; to the app package, see &quot;this&amp;quot;:The application descriptor file DTD article for more details. It is basically:


This line is the universal way to add any other “stuff” to the app package, see [[The|this]] application descriptor file <span class="caps">DTD</span> article for more details. It is basically:
<code><br /> &lt;asset path=&quot;&amp;lt;local_path_to_files&amp;amp;gt;/&amp;amp;lt;local_file_name&amp;amp;gt;&quot;&gt;&lt;on_device_path_to_files&amp;gt;/&amp;lt;on_device_file_name&amp;gt;&lt;/asset&amp;gt;<br /></code>


or even shorter:
or even shorter:


Note: we use an absolute path in the above example to handle shadow builds. A relative path works too, but will make shadow builds less portable than absolute paths <span class="smiley">:-)</span>
<code><br /> &lt;asset path=&quot;&amp;lt;SOURCE&amp;amp;gt;&quot;&gt;&lt;TARGET&amp;gt;&lt;/asset&amp;gt;<br /></code>
 
Note: we use an absolute path in the above example to handle shadow builds. A relative path works too, but will make shadow builds less portable than absolute paths :-)
 
You also have to add QML files:
 
<code><br />&lt;asset path=&quot;/Users/johndoe/projects/test_assets/qml&amp;quot;&gt;qml&amp;lt;/asset&amp;gt;<br /></code>
 
The key thing to know here is that the app installation folder is mapped to the folder &quot;app/native&amp;quot; in the application working directory (referred by QDir::currentPath(), i.e. a &quot;.&quot; folder in the BAR application descriptor file maps to the &quot;app/native/.&quot; folder. Our app, the app would be installed for example in:
 
<code><br />/accounts/1000/appdata/com.example.test_assets.testDev_test_assetscd80795f<br /></code>
 
The &quot;qt-logo.png&amp;quot; lands here:


You also have to add <span class="caps">QML</span> files:
<code><br />/accounts/1000/appdata/com.example.test_assets.testDev_test_assetscd80795f/app/native/qt-logo.png<br /></code>


The key thing to know here is that the app installation folder is mapped to the folder “app/native” in the application working directory (referred by QDir::currentPath(), i.e. a “.” folder in the <span class="caps">BAR</span> application descriptor file maps to the “app/native/.” folder. Our app, the app would be installed for example in:
The &quot;qml&amp;quot; folder will be recursively copied to<br /><code><br />/accounts/1000/appdata/com.example.test_assets.testDev_test_assetscd80795f/app/native/qml/<br /></code>


The “qt-logo.png” lands here:
Our app has only one QML file which lands here:


The “qml” folder will be recursively copied to <br />
<code><br />/accounts/1000/appdata/com.example.test_assets.testDev_test_assetscd80795f/app/native/qml/main.qml<br /></code>


Our app has only one <span class="caps">QML</span> file which lands here:
This QML code loads the image in &quot;main.qml&amp;quot; as:


This <span class="caps">QML</span> code loads the image in “main.qml” as:
<code><br /> Image {<br /> source: &quot;../qt-logo.png&amp;quot;<br /> anchors.centerIn: parent<br /> }<br /></code>


Notice the ../in the front of the file name! This is because the current folder of an Qt Quick element is where its file was loaded from. We load “main.qml” this way:
Notice the &quot;../&amp;quot; in the front of the file name! This is because the current folder of an Qt Quick element is where its file was loaded from. We load &quot;main.qml&amp;quot; this way:


“Image” assumes it is located in “app/native/qml/” and so needs to get one level up to get to ““app/native/qt-logo.png”.
<code><br />int main(int argc, char *argv[])<br />{<br /> QGuiApplication app(argc, argv);<br /> QQmlApplicationEngine engine;<br /> engine.load(QUrl(QStringLiteral(&quot;app/native/qml/main.qml&amp;quot;)));<br /> return app.exec&amp;amp;#40;&amp;#41;;<br />}<br /></code>


One more thing to notice. The article [https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html Working with the file system] ''[developer.blackberry.com]'' also talks about a dedicated “assets directory”. This is a bit confusing, since the “asset” <span class="caps">XML</span> element in the <span class="caps">BAR</span> application descriptor file can refer to any file, but the “assets directory” refers to the “asset” <span class="caps">URI</span> scheme in the Cascades framework. Using Cascades UI components you can load image as”
&quot;Image&amp;quot; assumes it is located in &quot;app/native/qml/&amp;quot; and so needs to get one level up to get to &quot;&quot;app/native/qt-logo.png&amp;quot;.


Doing the same in Qt Quick with Qt 4.8:
One more thing to notice. The article &quot;Working with the file system&amp;quot;:https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html also talks about a dedicated &quot;assets directory&amp;quot;. This is a bit confusing, since the &quot;asset&amp;quot; XML element in the BAR application descriptor file can refer to any file, but the &quot;assets directory&amp;quot; refers to the &quot;asset&amp;quot; URI scheme in the Cascades framework. Using Cascades UI components you can load image as&amp;quot;


does not work, since the “asset” scheme is not available in Qt Quick. There is another approach for this in Qt 5.2 and later.
<code><br />ImageView {<br /> imageSource: &quot;asset:///image.png&amp;quot;<br />}<br /></code>


===Prefer using the Qt resources===
Doing the same in Qt Quick with Qt 4.8:


Using Qt resources (via the “qrc://” scheme) for all small read-only files and especially for <span class="caps">QML</span> code files is a '''more preferred and convenient way'''! Accessing assets as files makes only sense for large read-only files or files which will be changed/created by the app.
<code><br /> Image {<br /> source: &quot;asset:///qt-logo.png&amp;quot;<br /> anchors.centerIn: parent<br /> }<br /></code>


===Viewing the folders on the device===
does not work, since the &quot;asset&amp;quot; scheme is not available in Qt Quick. There is another approach for this in Qt 5.2 and later.


In some cases, it might be needed to inspect the actual content of the folders directly on the device. You can do this in an <span class="caps">SSH</span> shell in the File Inspector in the Momentics <span class="caps">IDE</span>. The article [[BlackBerry Hints n Tips|BlackBerry Hints and Tips]] shows how to use <span class="caps">SSH</span> with BlackBerry 10 along with a few other hints and tips.
=== Prefer using the Qt resources ===


==Packaging and Deploying Qt5 applications using the binary Qt5 overlay==
Using Qt resources (via the &quot;qrc://&amp;quot; scheme) for all small read-only files and especially for QML code files is a '''more preferred and convenient way'''! Accessing assets as files makes only sense for large read-only files or files which will be changed/created by the app.


The easiest way to deploy Qt5 applications for testing and distribution in Blackberry World is to use the binary overlay explained in [[-Qt5-on-BlackBerry10-| Qt5 on BlackBerry10 ]]. It contains an experimental make specs add-on which provides special make targets for deployment and packaging. See the article [[Custom Qt on BlackBerry devices|Using custom Qt builds on BlackBerry 10 devices]] for details. This add-on also automates the deployment of a Qt runtime for a shared use which is explained below.
=== Viewing the folders on the device ===


==Shared use of data by multiple apps in development==
In some cases, it might be needed to inspect the actual content of the folders directly on the device. You can do this in an SSH shell in the File Inspector in the Momentics IDE. The article [[BlackBerry_Hints_n_Tips | BlackBerry Hints and Tips]] shows how to use SSH with BlackBerry 10 along with a few other hints and tips.


If your application has been packaged in the development mode (the <code>-devMode<code> option in <code>blackberry-nativepackager<code>), it gets slightly more permissions than if it was in the release mode (see [https://developer.blackberry.com/native/documentation/core/com.qnx.doc.ide.userguide/topic/package_deploy_about.html this article] ''[developer.blackberry.com]'' in the BlackBerry 10 documentation for mode details). One of those permissions is a read/write permission for the <code>devuser<code> home folder. <code>devuser<code> is a user account on the device linked to your debug token. You can use this folder if the apps use the same set of data for development purposes.</code></code></code></code></code></code></code></code>
== Packaging and Deploying Qt5 applications using the binary Qt5 overlay ==


This folder can also be used to deploy a Qt runtime in such a way that it can be accessed by multiple applications in the course of development. See the article [[Custom Qt on BlackBerry devices|Using custom Qt builds on BlackBerry 10 devices]] to learn how this works.
The easiest way to deploy Qt5 applications for testing and distribution in Blackberry World is to use the binary overlay explained in [[ Qt5-on-BlackBerry10 ]]. It contains an experimental make specs add-on which provides special make targets for deployment and packaging. See the article [[Custom_Qt_on_BlackBerry_devices|Using custom Qt builds on BlackBerry 10 devices]] for details. This add-on also automates the deployment of a Qt runtime for a shared use which is explained below.


===Categories:===
== Shared use of data by multiple apps in development ==


* [[:Category:BlackBerry|BlackBerry]]
If your application has been packaged in the development mode (the &lt;code&amp;gt;-devMode&amp;lt;code&amp;gt; option in &lt;code&amp;gt;blackberry-nativepackager&amp;lt;code&amp;gt;), it gets slightly more permissions than if it was in the release mode (see &quot;this article&amp;quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.ide.userguide/topic/package_deploy_about.html in the BlackBerry 10 documentation for mode details). One of those permissions is a read/write permission for the &lt;code&amp;gt;devuser&amp;lt;code&amp;gt; home folder. &lt;code&amp;gt;devuser&amp;lt;code&amp;gt; is a user account on the device linked to your debug token. You can use this folder if the apps use the same set of data for development purposes.

Revision as of 10:49, 24 February 2015


Deployment on BlackBerry 10

This article explains various details about deployment on BlackBerry 10 for Qt developers. Generally, this topic is well explained in the BlackBerry 10 documentation for native application development. In this article, you will find some additional details and tips specific for Qt development.

Start with BlackBerry 10 docs

It is good to get an overview first if you are new to a platform. Please read the following overview articles in the BlackBerry 10 documentation:
* "Developing apps&quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_stub_app_creation_process.html and all articles in that section.
* "The BAR application descriptor file ":https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_about_bar_app_descriptor_file.html and "App permissions&quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_appfund_accessing_restricted_functionality.html
* "App Life Cycle&quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_appfund_applifecycle.html
* "Working with the file system&quot;:https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html. This article also explains how standard Qt paths, e.g. <code&gt;QDir::homePath()<code&gt; are mapped to the file system.
* "Using low-level functionality&quot;:https://developer.blackberry.com/native/documentation/core/rtos.html

Application packaging

The page "Packaging, deployment and distribution&quot;:https://developer.blackberry.com/native/documentation/core/qt_package_deploy.html is a good introduction to the tools and how to use them.
In short, applications are packaged in so called BAR files which are zip archives with additional meta information.

Blackberry Application aRchive (BAR) descriptor file

A part of this meta information is the content of the "BAR application descriptor file&quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/c_about_bar_app_descriptor_file.html which is an XML file. This file describes the content of the package and where this content can be found. This file defines other important meta information as well, but this is less relevant to this article.

Qt Creator has an editor for the BAR application descriptor files which simplifies quite some manual editing.

The content of the package may also include images, sounds and any other data files used by the application in addition the the binary.

See "full list of all elements in a BAR application descriptor file&quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.native_sdk.devguide/topic/r_blackberry_tablet_dtd_intro.html

blackberry-nativepackager

Application packages are created by the command line tool <code&gt;blackberry-nativepackager&lt;code&gt; provided in the BlackBerry 10 NDK. This tool reads a BAR application descriptor file passed as an argument and builds the application package accordingly.

Application packages can be built in a development mode or can be built as signed packaged. Development mode applications require a debug token and can be installed and run on any device with the same debug token as they were build with.

Signed packaged are usually used for publishing in BlackBerry World. They can also be installed from the command line on any device in development mode and do no need a debug token.

See the full article about "Packaging, deployment and distribution&quot;:http://developer.blackberry.com/native/documentation/core/qt_package_deploy.html

Where do the app resources land on the device

Handling the sand box

Each application is installed in its own home folder on a dedicated partition. Shared folders (those which contain data to be shared between apps) are mapped according to permissions requested so that the app can access them under the standard paths. An important thing to keep in mind is that all applications can access files only within the boundaries of their "sandboxes&quot;. When the app asks to access shared data, according folders become available in app's sandbox as well. See "Working with the file system&quot;:https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html for an overview of all sub-folders for different purposes in app's home folder.

Applications cannot directly access any files outside their sandboxes. Even though it is possible to package and deploy libraries with the application, it is not possible to deploy any libraries into the system folders. Applications cannot share their libraries with other applications either.

Packaging and accessing the files

Even though the article "Working with the file system&quot;:https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html explains how the sandbox model influences file access, it might be clear from the beginning how paths can actually be referred in the application code.

Lets assume you have an app which loads an image with Qt Quick . The application code is located in the subfolder "test_assets&quot; in your "projects&quot; folder. The first thing you have to take care of is to add this image to the BAR application descriptor file:

<br /> &lt;asset path=&quot;/Users/johndoe/projects/test_assets/qt-logo.png&amp;quot;&gt;qt-logo.png&amp;lt;/asset&amp;gt;<br />

This line is the universal way to add any other "stuff&quot; to the app package, see "this&quot;:The application descriptor file DTD article for more details. It is basically:

<br /> &lt;asset path=&quot;&amp;lt;local_path_to_files&amp;amp;gt;/&amp;amp;lt;local_file_name&amp;amp;gt;&quot;&gt;&lt;on_device_path_to_files&amp;gt;/&amp;lt;on_device_file_name&amp;gt;&lt;/asset&amp;gt;<br />

or even shorter:

<br /> &lt;asset path=&quot;&amp;lt;SOURCE&amp;amp;gt;&quot;&gt;&lt;TARGET&amp;gt;&lt;/asset&amp;gt;<br />

Note: we use an absolute path in the above example to handle shadow builds. A relative path works too, but will make shadow builds less portable than absolute paths :-)

You also have to add QML files:

<br />&lt;asset path=&quot;/Users/johndoe/projects/test_assets/qml&amp;quot;&gt;qml&amp;lt;/asset&amp;gt;<br />

The key thing to know here is that the app installation folder is mapped to the folder "app/native&quot; in the application working directory (referred by QDir::currentPath(), i.e. a "." folder in the BAR application descriptor file maps to the "app/native/." folder. Our app, the app would be installed for example in:

<br />/accounts/1000/appdata/com.example.test_assets.testDev_test_assetscd80795f<br />

The "qt-logo.png&quot; lands here:

<br />/accounts/1000/appdata/com.example.test_assets.testDev_test_assetscd80795f/app/native/qt-logo.png<br />

The "qml&quot; folder will be recursively copied to

<br />/accounts/1000/appdata/com.example.test_assets.testDev_test_assetscd80795f/app/native/qml/<br />

Our app has only one QML file which lands here:

<br />/accounts/1000/appdata/com.example.test_assets.testDev_test_assetscd80795f/app/native/qml/main.qml<br />

This QML code loads the image in "main.qml&quot; as:

<br /> Image {<br /> source: &quot;../qt-logo.png&amp;quot;<br /> anchors.centerIn: parent<br /> }<br />

Notice the "../&quot; in the front of the file name! This is because the current folder of an Qt Quick element is where its file was loaded from. We load "main.qml&quot; this way:

<br />int main(int argc, char *argv[])<br />{<br /> QGuiApplication app(argc, argv);<br /> QQmlApplicationEngine engine;<br /> engine.load(QUrl(QStringLiteral(&quot;app/native/qml/main.qml&amp;quot;)));<br /> return app.exec&amp;amp;#40;&amp;#41;;<br />}<br />

"Image&quot; assumes it is located in "app/native/qml/&quot; and so needs to get one level up to get to ""app/native/qt-logo.png&quot;.

One more thing to notice. The article "Working with the file system&quot;:https://developer.blackberry.com/native/documentation/cascades/device_platform/data_access/file_system.html also talks about a dedicated "assets directory&quot;. This is a bit confusing, since the "asset&quot; XML element in the BAR application descriptor file can refer to any file, but the "assets directory&quot; refers to the "asset&quot; URI scheme in the Cascades framework. Using Cascades UI components you can load image as&quot;

<br />ImageView {<br /> imageSource: &quot;asset:///image.png&amp;quot;<br />}<br />

Doing the same in Qt Quick with Qt 4.8:

<br /> Image {<br /> source: &quot;asset:///qt-logo.png&amp;quot;<br /> anchors.centerIn: parent<br /> }<br />

does not work, since the "asset&quot; scheme is not available in Qt Quick. There is another approach for this in Qt 5.2 and later.

Prefer using the Qt resources

Using Qt resources (via the "qrc://&quot; scheme) for all small read-only files and especially for QML code files is a more preferred and convenient way! Accessing assets as files makes only sense for large read-only files or files which will be changed/created by the app.

Viewing the folders on the device

In some cases, it might be needed to inspect the actual content of the folders directly on the device. You can do this in an SSH shell in the File Inspector in the Momentics IDE. The article BlackBerry Hints and Tips shows how to use SSH with BlackBerry 10 along with a few other hints and tips.

Packaging and Deploying Qt5 applications using the binary Qt5 overlay

The easiest way to deploy Qt5 applications for testing and distribution in Blackberry World is to use the binary overlay explained in Qt5-on-BlackBerry10 . It contains an experimental make specs add-on which provides special make targets for deployment and packaging. See the article Using custom Qt builds on BlackBerry 10 devices for details. This add-on also automates the deployment of a Qt runtime for a shared use which is explained below.

Shared use of data by multiple apps in development

If your application has been packaged in the development mode (the <code&gt;-devMode&lt;code&gt; option in <code&gt;blackberry-nativepackager&lt;code&gt;), it gets slightly more permissions than if it was in the release mode (see "this article&quot;:https://developer.blackberry.com/native/documentation/core/com.qnx.doc.ide.userguide/topic/package_deploy_about.html in the BlackBerry 10 documentation for mode details). One of those permissions is a read/write permission for the <code&gt;devuser&lt;code&gt; home folder. <code&gt;devuser&lt;code&gt; is a user account on the device linked to your debug token. You can use this folder if the apps use the same set of data for development purposes.