Appinventor realizzazione app per Google Android OS.

34
appinventor realizzazione app per Google Android OS

Transcript of Appinventor realizzazione app per Google Android OS.

Page 1: Appinventor realizzazione app per Google Android OS.

appinventorrealizzazione app per Google Android OS

Page 2: Appinventor realizzazione app per Google Android OS.

drag & drop visual programming

appinventor è un’applicazione “drag & drop visual programming”

Contrariamente ai linguaggi tradizionali (text-based programming languages) è basato su componenti visuali come blocchi e icone che sono utilizzate dall’utente-programmatore mediante operazioni di drag-and-drop

Page 3: Appinventor realizzazione app per Google Android OS.

un esempio di drag & drop programming: Scratch

Scratch è un linguaggio di programmazione che rende semplice creare storie interattive, animazioni, giochi, musica e arte e condividere le tue creazioni sul web.

Quando i ragazzi creano e condividono i loro progetti Scratch, imparano importanti idee matematiche e computazionali e allo stesso tempo imparano a pensare creativamente, a ragionare con sistematicità e a lavorare in collaborazione.

http://scratch.mit.edu/

Page 4: Appinventor realizzazione app per Google Android OS.
Page 5: Appinventor realizzazione app per Google Android OS.

appinventor

È un semplice ambiente di sviluppo basato su piattaforma Java

App Inventor faceva parte di Google Labs, luogo virtuale ove gli ingegneri di Google sviluppano le nuove applicazioni sperimentali, ma il 10 agosto 2011 Google ha comunicato che App Inventor sarebbe stato chiuso, cosa che è avvenuta il 31 dicembre 2011.

Il sistema è stato preso in carico dal MIT Center for Mobile Learning che ora lo supporta con il nome "App Inventor Edu”

Page 6: Appinventor realizzazione app per Google Android OS.

storia

Presentato da Google nel dicembre 2010

Utilizza la Open Blocks library di Java del MIT

Simile a Scratch (altro lavoro del MIT)

Ospitato dai server MIT nel gennaio 2012

Page 7: Appinventor realizzazione app per Google Android OS.

la struttura di appinventor

Appinventor Designer permette di “disegnare” l’interfaccia grafica e scegliere i componenti

dell’applicazione è una web application ospitata su un server del MIT tutti i dati risiedono sul server (cloud computing) E’ possibile installare in locale un server contenente la web

application

Appinventor Blocks Editor permette di associare le azioni agli eventi è una Java Web Start Application che opera sul client

Emulatore per testare l’applicazione senza la necessità di un dispositivo android

Page 8: Appinventor realizzazione app per Google Android OS.

la struttura di appinventor

Page 9: Appinventor realizzazione app per Google Android OS.

designer

scelta dei componenti

da trascinare

sullo screenscreen (interfaccia dell’applicazione) Lista dei

componenti

proprietà del componente selezionato

Page 10: Appinventor realizzazione app per Google Android OS.

caricamento del blocks editor

“Open the Blocks Editor” per passare dal Designer al Blocks Editor

Esegue il download del file che contiene la Java Web Start application che deve essere eseguita sul client

Page 11: Appinventor realizzazione app per Google Android OS.

blocks editor

Page 12: Appinventor realizzazione app per Google Android OS.

blocks editor (Java Web Start)

Java Web Start (JavaWS, javaws o JAWS) è un framework sviluppato da Sun Microsystems (ora Oracle), che permette agli utenti di scaricare ed avviare applicazioni software per Java Platform direttamente da Internet utilizzando un browser web.

Il software Java Web Start: Permette una facile attivazione delle applicazioni mediante un

clic Garantisce che venga sempre eseguita l'ultima versione

dell'applicazione Elimina le complicate procedure d'installazione e di

aggiornamento

Page 13: Appinventor realizzazione app per Google Android OS.

“programmazione”

Nel Blocks Editor si compongono i blocchi che associano agli eventi associati ai componenti le azioni da compiere

Page 14: Appinventor realizzazione app per Google Android OS.

test dell’applicazione

è possibile testare l’applicazione mediante un emulatore android

Page 15: Appinventor realizzazione app per Google Android OS.

… o collegare direttamente il device

Page 16: Appinventor realizzazione app per Google Android OS.

Variable Declaration

• App Inventor: Declare Variables using the “Define Variable As” Block – Find the Blocks Editor (top-left), click the Definition button, then pull

out the correct block.

Page 17: Appinventor realizzazione app per Google Android OS.

Variable Assignment• Assign a variable named “count” to 5

– In App Inventor, use “set global - to” block in the My Blocks Menu• Only available once defined your variable• Drag the “set global - to” block out• Create a number block by typing in “5” in the editor window• Click 5 into the “set global – to” block

Page 18: Appinventor realizzazione app per Google Android OS.

App Inventor Math using VariablesCombine the “Set-To” Block with operators from the “Built-In->Math” Menu

Count = 9

Count = 5

Count = 14

Count = 3

Count = 1 (modulo gives the remainder of division)

Page 19: Appinventor realizzazione app per Google Android OS.

Variable Initialization

Page 20: Appinventor realizzazione app per Google Android OS.

• You are forced to define a variables value when you declare it in App Inventor

• A general place for program initialization is the “When Screen1.Initialize” block – Note: Most Text-Based languages use the “main()” function as

the start of the program– For example, set count to 100 when the program starts:

Page 21: Appinventor realizzazione app per Google Android OS.

Implementing an Equation inApp Inventor

• Area of a Rectangle = Length * Width– Step 1: What variables do we need?

• Area, Length, and Width

– Step 2: Declare them in App Inventor– Step 3: Use Math. Operators to Implement

Page 22: Appinventor realizzazione app per Google Android OS.

Output: The Label Component• Label

– Components used to show text. – Displays text specified by the Text property. – Useful Properties

• Text• Width• Visible• Background Color

Page 23: Appinventor realizzazione app per Google Android OS.

Output: The Image Component• Image

– Components used to show a picture– Displays text specified by the Picture property. – Useful Properties

• Picture• Width• Visible• Height

Page 24: Appinventor realizzazione app per Google Android OS.

Output: The Texting Component• Texting

– A non-visible component to allow users to send andreceive text messages. – Useful Properties

• Message• Phone Number• Receiving Enabled (Does this also make the Texting component a input?)

Page 25: Appinventor realizzazione app per Google Android OS.

Input: The Button Component• Button

– Components used to show text. – Displays text specified by the Text property. – Useful Properties

• Text• Width• Visible• Background Color

Page 26: Appinventor realizzazione app per Google Android OS.

Input: The TextBox Component• TextBox

– Components used to show text. – Displays text specified by the Text property. – Useful Properties

• Text• Width• Visible• Background Color

Page 27: Appinventor realizzazione app per Google Android OS.

If-Blocks

Page 28: Appinventor realizzazione app per Google Android OS.
Page 29: Appinventor realizzazione app per Google Android OS.

Nesting If and If-Else BlocksOften times, we want to check if a prior condition is true, before checking another condition.

– Example: If x > 100, then check if y is < 100. If y < 100, then assign z to 1. If x <= 100, set z to 35.

Page 30: Appinventor realizzazione app per Google Android OS.

ImplementationStep 1: Lamp Doesn’t Work

– If-Block or If-Else Block? Why?

Page 31: Appinventor realizzazione app per Google Android OS.

Step 2: Lamp Plugged In?

Page 32: Appinventor realizzazione app per Google Android OS.

Step 3: Bulb Burned Out?

Page 33: Appinventor realizzazione app per Google Android OS.
Page 34: Appinventor realizzazione app per Google Android OS.

Tips

E’ possibile copiare e incollare un insieme di blocchi Ctrl C – Ctrl V

E’ possibile digitare un valore numerico o booleano e viene automaticamente creato il blocco

Con click destro su un blocco è possibile associare un commento disattivare il blocco eseguire il blocco controllare il valore di una variabile