Difference between revisions of "Plasma/Mobile/AppDevelopment"

< Plasma‎ | Mobile
Jump to: navigation, search
(Initial page creation)
(Move notice)
(2 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Note|This page is now on [[https://docs.plasma-mobile.org/AppDevelopment.html https://docs.plasma-mobile.org]]}}
The setup described in this page is still a proposal. It works, but is not yet adopted as "the official way".
= Plasma Mobile application development =
This page will guide your through creating a properly packaged Plasma Mobile app. We will use the KDE flatpak SDK to develop and package the app, so all that is required is a working flatpak and flatpak-builder installation.
On Debian and derivates, you can use <code>sudo apt install flatpak flatpak-builder</code>.
= Using the Kirigami application template =
First, clone the app template: <code>git clone https://gitlab.com/jbbgameich/plasma-mobile-app-template.git</code>
This repository can be used as a template to develop Plasma Mobile applications. It already includes templates for the qml ui, a c++ part, app metadata and flatpak packaging.
== Local building and testing using the SDK ==
<pre>flatpak install flathub org.kde.Sdk//5.11 # Only needs to be done once
flatpak-builder flatpak-build-desktop --force-clean --ccache *.json
flatpak-builder --run flatpak-build-desktop *.json hellokirigami</pre>
== Creating a flatpak for the phone ==
This assumes your system is already set up as described [https://community.kde.org/Guidelines_and_HOWTOs/Flatpak here]. Make sure your system also supports qemu user emulation. If not, you can find help for example [https://wiki.debian.org/QemuUserEmulation here]
<pre>flatpak install flathub org.kde.Sdk/arm/5.11 # Only needs to be done once
flatpak-builder flatpak-build-phone --repo=arm-phone --arch=arm --force-clean --ccache *.json
flatpak build-bundle arm-phone app.flatpak org.kde.hellokirigami</pre>
Now your app is exported into app.flatpak. You can copy the file to the phone using scp:
<pre>scp app.flatpak [email protected]:/home/phablet/app.flatpak</pre>
flatpak install app.flatpak</pre>
Your new application should now appear on the homescreen.
== Using the template to develop your application ==
Edit the files to fit your naming and needs. In each command, replace “io.you.newapp” and “newapp” with the id and name you want to use
<pre>find . -name &quot;CMakeLists.txt&quot; -or -name &quot;*.desktop&quot; -or -name &quot;*.xml&quot; -or -name &quot;*.json&quot; -exec sed -i 's/org.kde.hellokirigami/io.you.newapp/g;s/hellokirigami/newapp/g' {} \;
for file in $(find . -name &quot;org.kde.hellokirigami*&quot;); do mv $file $(echo $file | sed &quot;s/org.kde.hellokirigami/io.you.newapp/g&quot;); done</pre>
== Submitting your new application to the repository ==
Once your application is working and is usable, you can submit a patch to include it into the KDE flatpak repository.
After setting up git with the recommended [https://community.kde.org/Infrastructure/Git#Pushing KDE settings], you can create a new file io.you.newapp.remoteapp in the flatpak-kde-applications repository.
<code>git clone kde:flatpak-kde-applications &amp;&amp; cd flatpak-kde-applications</code>
Paste the following content into the file:
You can now submit the patch on [https://community.kde.org/Infrastructure/Phabricator Phabricator]. Once accepted, your app will be automatically built, published and made available in Discover (if the KDE flatpak repository is enabled on the device).

Latest revision as of 22:51, 5 February 2019

This page is now on [https://docs.plasma-mobile.org]

This page was last edited on 5 February 2019, at 22:51. Content is available under Creative Commons License SA 4.0 unless otherwise noted.