Ubuntu Phone: the community smartphone

47
Ubuntu Phone: the community smartphone Giulio Collura

description

Presentazione per Codemotion Milan 2014 La piattaforma Ubuntu, quali sono le tecnologie utilizzate da Ubuntu per la nuova piattaforma. Da dove partire a sviluppare nuove app per Ubuntu Touch e Desktop con l'Ubuntu SDK. Piccola introduzione al linguaggio QML. Come contribuire alle Core Apps e come mettersi in contatto con la community di Ubuntu-it

Transcript of Ubuntu Phone: the community smartphone

Page 1: Ubuntu Phone: the community smartphone

Ubuntu Phone: the community smartphone

Giulio Collura

Page 2: Ubuntu Phone: the community smartphone

Ubuntu› a new force in mobile

Page 3: Ubuntu Phone: the community smartphone

Il futuro del computing

› Ubuntu funziona su smartphone, desktop, server e cloud

› Interfaccia veloce e intuitiva per ogni dispositivo

› Core Apps di qualità e un ecosistema di app in continua crescita

› Ubuntu SDK con supporto nativo e HTML5

› Differenziazione senza frammentazione

Page 4: Ubuntu Phone: the community smartphone

Spazio agli sviluppatori

Ubuntu fornisce tutti gli strumenti necessari allo sviluppo

› Ubuntu SDK

› Applicazioni native e HTML5

› Portale con documentazione, tutorial e API reference

› Linee guida per il design

› Processo di upload e pubblicazione app semplice e sicuro

› Ubuntu Store

› Comunità di sviluppatori e designer attiva e entusiasta

Page 5: Ubuntu Phone: the community smartphone

Design

› Focus sui contenuti

› Interazioni semplici, veloci e naturali

› Stile unico

Un telefono in cui ti puoi rispecchiare

Page 6: Ubuntu Phone: the community smartphone

Ubuntu User Experience

› Spazio ai contenuti

› Gestures semplici e intuitive

Page 7: Ubuntu Phone: the community smartphone

Unity

› Unity è la shell di Ubuntu

› Per gli utenti, fornisce una semplice e touch-ready

Page 8: Ubuntu Phone: the community smartphone

La piattaforma Ubuntu

› Sistema Operativo Ubuntu, con un layer Android per il device

› Unity

› Ubuntu SDK fornisce API trasparente per l'accesso ai servizi, device

Page 9: Ubuntu Phone: the community smartphone

Convergenza

› QtQuick

› Non solo adattamento nella dimensione dei componenti, design e modi d'uso devono essere ottimizzati

› La prima versione LTS a essere completamente convergente sarà la 16.04

› Unity 8, già in uso su smartphone e tablet, rimpiazzerà Unity 7 nella versione desktop

Page 10: Ubuntu Phone: the community smartphone

foundations› SDK

Page 11: Ubuntu Phone: the community smartphone

Ubuntu SDK

› Fornisce tutti gli strumenti per sviluppare app semplicemente

› Disponibile per numerosi linguaggi:

› QML, linguaggio dichiarativo utile a descrivere l'interfaccia utente di un programma

› Javascript

› C++

› HTML5

Page 12: Ubuntu Phone: the community smartphone

QtQuick

› Interfacce utente semplici e veloci

› Design-oriented

› Sviluppo rapido

› Il QML è un linguaggio dichiarativo che consente agli oggetti di essere definiti secondo le loro proprietà e di come possono interagire e rispondere ai cambiamenti

Page 13: Ubuntu Phone: the community smartphone

Componenti

› Layouts

› Resolution Independence

› Localizzazioni

› Cloud-ready

› Emulatore

› Servizi

› Command-line parsing

Page 14: Ubuntu Phone: the community smartphone

Ambiente di sviluppo

› Qt Creator

› Completo supporto al C++ e QML

› Interfaccia grafica per la gestione del dispositivo

› Connessione al device tramite SSH (Secure Shell)

› Permette l'avvio e l'interruzione di applicazioni durante lo sviluppo

› Comprende tool di packaging, convalida e installazione

› Cross-compilation direttamente dal desktop

› Accesso diretto alla documentazione

› Linea di comando

Page 15: Ubuntu Phone: the community smartphone

Ciclo di vita di una app

› Le app sono sospese quando non visibili

› Il ciclo di vita di una app è progettato per essere semplice, sicuro e ottimizzare il consumo di batteria

Page 16: Ubuntu Phone: the community smartphone

Sicurezza

› Tutte le app sono confinate grazie ad AppArmor, tramite specifiche restrizioni

› AppArmor è un modulo di sicurezza del kernel

› Ogni app possiede un profilo AppArmor definito tramite un file di configurazione

› Ogni app può solo scrivere nella propria directory

› Lo scambio di informazioni tra app è consentito tramite ContentHub

Page 17: Ubuntu Phone: the community smartphone

Qt/QML e web app

› Supporto completo per entrambe le piattaforme di sviluppo

› Massime performance con il supporto nativo

› Tutte le potenzialità del web grazie alle web app

› HTML 5 e CCS 3

› Nessuna modifica richiesta alle webapp già esistenti

Page 18: Ubuntu Phone: the community smartphone

App native

› Scrivere app native per sfruttare tutta la potenza del dispositivo

› QML + Javascript + C++ (e Go)

› Il Javascript si integra direttamente nel QML

› Grazie alle librerie Qt, il C++ non è mai stato così semplice da usare

› C++ per il backend come un plugin, QML per il frontend

Page 19: Ubuntu Phone: the community smartphone

Click packages

› I pacchetti Click (.click) sono il nuovo modo in cui sono impacchettate, distribuite e installate le app per Ubuntu Touch e, in futuro, Ubuntu Desktop

› Progettati per essere semplici, veloci e sicuri, grazie all'integrazione di AppArmor

› Forniscono isolamento tra aggiornamenti del sistema e delle app

› Gli aggiornamenti del sistema vengono forniti tramite aggiornamenti OTA (over-the-air) incrementali

› Gli aggiornamenti delle app tramite pacchetti click

Page 20: Ubuntu Phone: the community smartphone

app project› design › develop › publish

Page 21: Ubuntu Phone: the community smartphone

Installazione

› Tramite terminale:

› Per Ubuntu 12.04 LTS e 14.04 LTS

› Per versioni in sviluppo

sudo add-apt-repository ppa:ubuntu-sdk-team/ppa && sudo apt-get update && sudo apt-get dist-upgrade && sudo apt-get install ubuntu-sdk

sudo apt-get update && sudo apt-get install ubuntu-sdk

Page 22: Ubuntu Phone: the community smartphone

Nuovo progetto

› Idee

› Nuove applicazioni

› Porting di Harmattan apps

› Remake di app iOS e Android

› Tutorial

› Disponibili in rete http://developer.ubuntu.com

› Design guidelines

› http://design.ubuntu.com/apps

› Reference

› Core Apps

Page 23: Ubuntu Phone: the community smartphone
Page 24: Ubuntu Phone: the community smartphone
Page 25: Ubuntu Phone: the community smartphone

› Kit: ambiente con architettura emulata armhf o i386

› Consente la cross-compilation e la cross-configuration di una app

Page 26: Ubuntu Phone: the community smartphone

› Gestione del device direttamente da QtCreator

› Sono forniti anche tool da linea di comando

› sudo apt-get install phablet-tools

Page 27: Ubuntu Phone: the community smartphone

Struttura del QML

› Il QML è un linguaggio dichiarativo

› Specificare un id serve a rendere il componente accessibile da altre parti nel codice

› Esempio:

Rectangle { id: canvas width: 200 height: 200 color: "blue" }

Page 28: Ubuntu Phone: the community smartphone

› Gli oggetti possono essere innestati

› Notare come logo acceda alle proprietà di rect

import QtQuick 2.0

Rectangle { id: rect width: 300 height: 300 color: "orange"

Image { id: logo source: "calculator.svg" anchors.centerIn: parent height: rect.height / 2 width: rect.width / 2 } }

Page 29: Ubuntu Phone: the community smartphone

Integrazione JavaScript e QML

Codice JavaScript può essere integrato con semplicità per fornire controllo sugli elementi e altri benefici

Item { width: randomNumber()

height: width < 100 ? 100 : (width + 50) / 2 function randomNumber() {

return Math.random() * 360; }}

Page 30: Ubuntu Phone: the community smartphone

MainView

› Componente principale per tutte le applicazioni

› Aggiunge automaticamente un header, utile alla gestione di Tab e comandi

› Ruota automaticamente i contenuti a seconda della rotazione del device

› Modulo di Ubuntu.Components

› import Ubuntu.Components 1.0

Page 31: Ubuntu Phone: the community smartphone

main.qml

import QtQuick 2.1

import Ubuntu.Components 1.1

import "ui"

MainView {

objectName: "mainView"

applicationName: "com.ubuntu.developer.<devname>.<appname>"

Tabs {

id: tabs

HelloTab {

objectName: "helloTab"

}

WorldTab {

objectName: "worldTab"

}

}

}

Page 32: Ubuntu Phone: the community smartphone

Resolution Independence

Device Conversione

Comuni schermi(laptop, desktop)

1 gu = 8 px

Retina display 1 gu = 16 px

Smartphones 1 gu = 18 px

Tablet 1 gu = 10 px

› L'obiettivo è rendere semplice lo sviluppo di interfacce grafiche scalabili per ogni form factor

› Grid Unit (gu)

› Density Indipendent Pixel (dp)

Page 33: Ubuntu Phone: the community smartphone

Nuovi componenti

› È utile creare nuovi componenti esternamente per modularizzare la propria applicazione

› Molto semplice

› È necessario creare un nuovo modulo .qml all'interno del progetto

Page 34: Ubuntu Phone: the community smartphone

Esempio

components/HelloComponent.qml

import QtQuick 2.0

import Ubuntu.Components 0.1

UbuntuShape {

width: 200

height: width

property alias text: myText.text

Label {

id: myText

anchors.centerIn: parent

}

}

main.qml

import QtQuick 2.0

import Ubuntu.Components 0.1

import "components"

MainView {

width: units.gu(48)

height: units.gu(60)

Page {

title: "Example page"

HelloComponent {

anchors.centerIn: parent

text: "Hello world!"

}

}

}

Page 35: Ubuntu Phone: the community smartphone

Convergenza

› Una sola codebase per tutti i dispositivi

› Uso efficiente dello spazio dello schermo

› Interfacce dinamiche

Page 36: Ubuntu Phone: the community smartphone

Layouts

Page 37: Ubuntu Phone: the community smartphone

Ubuntu.Layouts

› Componente dell'SDK utile a posizionare i vari elementi date certe condizioni

› import Ubuntu.Layouts 1.0› Elementi

› Layouts

› ItemLayout

› ConditionalLayout

Page 38: Ubuntu Phone: the community smartphone

U1db

› Modulo per la gestione di un database basato su JSON objects

› Molto semplice da usare

› Comodo per salvare impostazioni e informazioni permanentemente con sincronizzazione cross device

› import U1db 1.0 as U1db› Policy: networking

Page 39: Ubuntu Phone: the community smartphone

The Ubuntu dash and scopes architecture

› Ricerche veloci attraverso la Dash

› Le Scope sono responsabili di fornire alla Dash i risultati di ricerca tramite specifiche categorie

Page 40: Ubuntu Phone: the community smartphone

Scopes

› Finestra su un mondo di contenuti

Page 41: Ubuntu Phone: the community smartphone

Scopes data flow

Page 42: Ubuntu Phone: the community smartphone

Scope API

› API in C++

› Separazione tra Data e View

› Personalizzabili

› Più visibilità al brand

› Giusta importanza ai giusti contenuti

Page 43: Ubuntu Phone: the community smartphone

Community

› Piattaforma di sviluppo

› Launchpad – launchpad.net

› IRC:

› Internazionali:

› #ubuntu-touch

› #ubuntu-app-devel

› Italiani:

› #ubuntu-it

› #ubuntu-it-dev

› Ask

› http://askubuntu.com/

› http://chiedi.ubuntu-it.org/

› Facebook

› Gruppo ubuntu-it

Page 44: Ubuntu Phone: the community smartphone

Come collaborare alle Core Apps

› Registrarsi a Launchpad

› Collegarsi a

› https://launchpad.net/ubuntu-phone-coreapps/

› Scegliere un progetto

› bzr branch lp:<repo-name>› Hack!

› …

› Richiedi una Merge Proposal

› bzr lp-propose-merge

Page 45: Ubuntu Phone: the community smartphone

Squash bugs!

› Ogni progetto ha un proprio bug tracker

Page 46: Ubuntu Phone: the community smartphone

Domande

Page 47: Ubuntu Phone: the community smartphone

Contatti

Email: [email protected]: @gcollura93

Github, Launchpad, IRC: gcollura

Le slide saranno disponibili sulla mia pagina web:http://gcollura.github.io/projects

Grazie!