Ceci est une ancienne révision du document !
As promised last month, I’ll be covering some more ubuntu phone programming. While preparing for this article, I have looked at most of the tutorials from Ubuntu itself. They are well written, and definitely a good spot to start. I will focus on more general approaches - what app type to use for what purpose, as well as a small example of a web app.
App Types
• HTML5 app - this is a full-fledged HTML app. If you’re a web developer and want to create a specific HTML5 app for Ubuntu, you’ll want this. • Webapp - this is the app type you use to open an existing page, in order to run it like an app. • QML - A native app for Ubuntu (written in QML, which is the Qt Meta Language). • Scopes - These can be written in various languages, and combined with APIs.
Webapp
As an example, I’ll briefly cover how to create a webapp for opening the Full Circle Magazine site.
• Create a new Webapp project • Open <appname>.desktop • Edit the exec line to read: Exec=webapp-container –enable-back-forward –store-session-cookies –webappUrlPatterns=https?:fullcirclemagazine.org/* http://fullcirclemagazine.org • Replace <appname>.png with a 128px x 128px icon (eg. the FCM circular logo). The important step is the third one. Here you indicate the allowed URL patterns - in this case we allow any https or http (https?:) connection to fullcirclemagazine.org, and its subpages (/*). This way, the site can be browsed. It’s possible to supply multiple patterns - for example for subdomains.
As you can see - creating a basic webapp is extremely simple. If you want to connect an account, you can either log in via the web interface (as normal) by setting the login page to the default URL (last URL in the Exec line). If you want to use the OnlineAccounts API, you’ll apparently need to use a fully-fledged HTML5 app. If the site you’re connecting to also offers an API, using an HTML5 app (and asking for credentials in settings), you should be able to connect via API as well. See the examples on the Ubuntu page for more details.
QML App
I was planning on also including a QML app example here, but have faced various issues with translations and the make files required for compiling a QML app. Instead, I’m trying to fix the issues, so that I can hopefully cover QML apps in my next article.
Questions for readers
Are there any Ubuntu phone apps you can’t live without? Or maybe there’s a particular style of app you’re curious about. Send me an email, and I will see if I can’t include an answer in my next article.
In general - is there something you’d like to see more of from me in 2016? All answers can be emailed to: lswest34+fcm@gmail.com.
I hope everyone’s had a good year, and thank you for reading C&C!
Further Reading HTML5 apps: https://developer.ubuntu.com/en/apps/html-5/tutorials/ Get started: https://developer.ubuntu.com/en/apps/qml/tutorials/building-your-first-qml-app/ Webapp: https://developer.ubuntu.com/en/web/tutorials/ QML Apps: https://developer.ubuntu.com/en/apps/qml/tutorials/ Scopes: https://developer.ubuntu.com/en/scopes/tutorials/