sviluppare una live app: notifiche, live tile, lock screen
DESCRIPTION
Una caratteristica di Microsoft Windows Phone che la rende unica rispetto alle altre piattaforma è il supporto alle Live Tile, che consentono di mostrare informazioni all'utente direttamente nella home screen, senza costringerlo ad aprire l'applicazione. In Windows Phone 8 questa potenzialità è stata portata ai massimi livelli, grazie al supporto a nuovi formati e template di Live Tile e alla possibilità di interagire con la lock screen. Nel corso del webinar impareremo come sfruttare queste funzionalità grazie alle notifiche. / A unique feature of Microsoft Windows Phone is support for Live Tiles, which can be used to display information from an application on the home screen without forcing users to open the app. Windows Phone 8 enhancements support new formats and Tile templates and include the ability to interact with the lock screen. In this webinar, you’ll learn how to leverage these features through the Windows Phone notifications capability.TRANSCRIPT
SVILUPPARE UNA LIVE APP NOTIFICHE, LIVE TILE, LOCK SCREEN
Dan ArdeleanNokia Developer [email protected] Twitter: @danardelean
NOKIA WEBINAR
04/11/2023
1. FONDAMENTALE per le applicazioni Windows Phone
2. Differenzia nettamente Windows Phone dagli altri smartphone
3. Dei metodi per far tornare l’utente ad usare la vostra applicazione
LIVE APPS
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
LIVE APPS
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
Live Tile
Lock screen
Notifiche
Background agents
AGENDA
04/11/2023
• La «porta» principale per accedere alla vostra applicazione
• Uno spazio dove fornire il massimo delle informazioni utili all’utente
• NON è solo un collegamento alla vostra applicazione
• Accesso veloce alle funzionalità più usate
LIVE TILES
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
Flip
Iconic
Cycle
TILE TEMPLATES AND TILE SIZES
6
04/11/2023
Doppio-click su WMAppManifest.xml
IMPOSTAZIONI TILE PRINCIPALE
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
DIMENSIONI IMMAGINI
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
Dimensione Tile Template Flip e Cycle
Template Iconic
Small 159 x 159 pixels 159 x 159 pixels 110 x 110 pixels
Medium 336 x 336 pixels 336 x 336 pixels 202 x 202 pixels
Wide 691 x 336 pixels 691 x 336 pixels N/A
04/11/2023
FLIP
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
ICONIC
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
CYCLE
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
PIÙ IMPORTANTE DELLA DEMODESIGN & FUNZIONALITÀ
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
ME TILE - FLIP
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
• Non mi da informazioni essenziali sulla parte frontale
• Devo aspettare che si gira = LENTA
• Non ho più informazioni della versione piccola
?• INUTILE• Versione IL NARCISISTA
XOK
04/11/2023
EMAIL - ICONIC
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
OK
OK?
04/11/2023
CYCLE - FOTO
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
BISOGNA ESSERE CREATIVI
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
Bing Finance My Stocks Portfolio+
X
04/11/2023
DEMO TILE
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
• Aggiornamento immagine di background delle tile usando la
proprietà RemoteImageUri
• L’immagine deve essere più piccola di 150KB Tempo di download <
45 sec.
• Risoluzione minima 1 ora
• Rimossa dopo 3 tentativi consecutivi falliti
• Ricorrenza Onetime, EveryHour, EveryDay, EveryWeek or
EveryMonth
SHELLTILESCHEDULE
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
DEMO SHELL TILE SCHEDULE
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
• La prima cosa che l’utente vede quando accende il telefono
• Le applicazioni possono fornire il background della lockscreen, stato dettagliato o quick status
• WMAppManifest.xml
LOCKSCREEN
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
<Extensions> <Extension ExtensionName="LockScreen_Notification_IconCount" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" /> <Extension ExtensionName="LockScreen_Notification_TextField" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" /> <Extension ExtensionName="LockScreen_Background" ConsumerID="{111DFF24-AA15-4A96-8006-2BFF8122084F}" TaskID="_default" /></Extensions>
04/11/2023
ICONA:30 x 30 pixel PNG – bianca e sfondo trasparenteNome default - LockIcon.png
<DeviceLockImageURI IsRelative="true" IsResource="false">Assets\Lock\LockIcon.png</DeviceLockImageURI>
Prende le informazioni della tile principaleNon è necessario che la tile principale si trovi nella videata Start
BACKGROUND:Dalle risorse della app ms-appx:///
Uri imageUri = new Uri("ms-appx:///background1.png", UriKind.RelativeOrAbsolute); LockScreen.SetImageUri(imageUri);
Da IsolatedStorage, ms-appdata:///local/Uri imageUri = new
Uri("ms-appdata:///local/background2.png",UriKind.RelativeOrAbsolute);LockScreen.SetImageUri(imageUri);
LOCKSCREEN
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
DEMO LOCKSCREEN
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
• Raw• Protocollo custom• Inviato solo se l’applicazione è in esecuzione
• Toast• Protocollo XML• Se l’applicazione non è in esecuzione notifica Toast
• Tile• Protocollo XML• Se la Tile è pinned viene aggiornata
NOTIFICHE PUSH
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
PUSH NOTIFICATION DATA FLOWURI to the service:
"http://notify.live.com/throttledthirdparty/01.00/AAFRQHgiiMWNTYrRDXAHQtz-
AgrNpzcDAwAAAAQOMDAwMDAwMDAwMDAwMDA"Push enabled applications
Notifications service
HTTP POST the message
Push endpoint is established. URI is created for the endpoint.
1
2
3
Third-party
service
MPNS:Microsoft
hosted server
Send PN Message
4
04/11/2023
• TOAST
• TILE
• RAW
NOTIFICHE HTTP HEADERS
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
sendNotificationRequest.ContentType = "text/xml";sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", "toast");sendNotificationRequest.Headers.Add("X-NotificationClass", "<batching interval>");
sendNotificationRequest.ContentType = "text/xml";sendNotificationRequest.Headers.Add("X-WindowsPhone-Target", “token");sendNotificationRequest.Headers.Add("X-NotificationClass", "<batching interval>");
sendNotificationRequest.ContentType = "text/xml";sendNotificationRequest.Headers.Add("X-NotificationClass", "<batching interval>");
04/11/2023
TOAST SCHEMA
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
string toastMessage = "<?xml version=\"1.0\" encoding=\"utf-8\"?>" + "<wp:Notification xmlns:wp=\"WPNotification\">" + "<wp:Toast>" + "<wp:Text1>WEATHER ALERT</wp:Text1>" + "<wp:Text2>Stormy</wp:Text2>" + "<wp:Param>/page1.xaml?value1=1234<wp:Param>" + "</wp:Toast>" + "</wp:Notification>";
04/11/2023
FLIP TEMPLATE SCHEMA
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
<?xml version="1.0"?><wp:Notification xmlns:wp="WPNotification" Version="2.0"> <wp:Tile Id="[TileId]" Template="FlipTile"> <wp:SmallBackgroundImage Action="Clear">[sm tile img URI]</wp:SmallBackgroundImage> <wp:WideBackgroundImage Action="Clear">[front of wd tile img URI]</wp:WideBackgroundImage> <wp:WideBackBackgroundImage Action="Clear">[back of wd tile img URI]</wp:WideBackBackgroundImage> <wp:WideBackContent Action="Clear">[back of wd tile content text]</wp:WideBackContent> <wp:BackgroundImage Action="Clear">[front of med tile img URI]</wp:BackgroundImage> <wp:Count Action="Clear">[count]</wp:Count> <wp:Title Action="Clear">[title text]</wp:Title> <wp:BackBackgroundImage Action="Clear">[back of med tile img URI]</wp:BackBackgroundImage> <wp:BackTitle Action="Clear">[back of tile title text]</wp:BackTitle> <wp:BackContent Action="Clear">[back of med tile content text]</wp:BackContent> </wp:Tile></wp:Notification>
04/11/2023
CYCLE TEMPLATE SCHEMA
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
<?xml version="1.0"?><wp:Notification xmlns:wp="WPNotification" Version="2.0"> <wp:Tile Id="[TileId]" Template="CycleTile"> <wp:SmallBackgroundImage Action="Clear">[sm tile img URI]</wp:SmallBackgroundImage> <wp:CycleImage1 Action="Clear">[photo 1 img URI]</wp:CycleImage1> <wp:CycleImage2 Action="Clear">[photo 2 img URI]</wp:CycleImage2> <wp:CycleImage3 Action="Clear">[photo 3 img URI]</wp:CycleImage3> <wp:CycleImage4 Action="Clear">[photo 4 img URI]</wp:CycleImage4> <wp:CycleImage5 Action="Clear">[photo 5 img URI]</wp:CycleImage5> <wp:CycleImage6 Action="Clear">[photo 6 img URI]</wp:CycleImage6> <wp:CycleImage7 Action="Clear">[photo 7 img URI]</wp:CycleImage7> <wp:CycleImage8 Action="Clear">[photo 8 img URI]</wp:CycleImage8> <wp:CycleImage9 Action="Clear">[photo 9 img URI]</wp:CycleImage9> <wp:Count Action="Clear">[count]</wp:Count> <wp:Title Action="Clear">[title text]</wp:Title> </wp:Tile></wp:Notification>
04/11/2023
ICONIC TEMPLATE SCHEMA
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
<?xml version="1.0"?><wp:Notification xmlns:wp="WPNotification" Version="2.0"> <wp:Tile Id="[TileId]" Template="IconicTile"> <wp:SmallIconImage Action="Clear">[sm icon img URI]</wp:SmallIconImage> <wp:IconImage Action="Clear">[med/wd icon img URI]</wp:IconImage> <wp:WideContent1 Action="Clear">[wd tile content line 1]</wp:WideContent1> <wp:WideContent2 Action="Clear">[wd tile content line 2]</wp:WideContent2> <wp:WideContent3 Action="Clear">[wd tile content line 3]</wp:WideContent3> <wp:Count Action="Clear">[count]</wp:Count> <wp:Title Action="Clear">[title text]</wp:Title> <wp:BackgroundColor Action="Clear">[hex ARGB background color of tile]</wp:BackgroundColor> </wp:Tile></wp:Notification>
04/11/2023
Windows Phone 8 JumpStart Module 08: Push Notifications
http://channel9.msdn.com/Series/MVA-Jump-Start/Building-Apps-for-Windows-Phone-8-Jump-Start-08-Push-Notifications
http://code.msdn.microsoft.com/Windows-Phone-8-JumpStart-ab6c839a
SAMPLE E APPROFONDIMENTI
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
DEMO NOTIFICHE PUSH
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
PeriodicTask• Eseguito ogni 30 minuti• Massimo 25 secondi
ResourceIntensiveTask• Il telefono è in carica collegato via WiFi e carica batteria >90%• Il telefono non viene usato• Tempo massimo di esecuzione 10 minuti
• Utilizzo memoria <= 6 MB• Cancellato dopo 2 crash consecutivi
BACKGROUND TASKS
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023
ACCESSO CONCORRENZIALE
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
public bool LoadLogFromIsolatedStorageFile(){ mut.WaitOne(); // Wait until it is safe to enter
try { // read the file here return true; } catch { LogText = ""; return false; } finally { mut.ReleaseMutex(); // Release the Mutex. }}
04/11/2023
Trasferimento da/verso IsolatedStorageFunzionano quando l’applicazione non è in primo pianoCollegamenti HTTP e HTTPSPossibilità di monitorare lo statoImpostare le condizioni usando TransferPreferencesDimensioni file:
• Upload : 5Mb• Download usando dati cellulare: 20Mb• Download usando WiFi: 100Mb
Dimensione massima coda trasferimenti 25
BACKGROUND TRANSFERS
© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
04/11/2023© 2013 Nokia. All rights reserved.© 2013 Microsoft. All rights reserved.
Grazie!
Blog: sviluppomobile.blogspot.comEmail: [email protected]: @danardelean