SlideShare ist ein Scribd-Unternehmen logo
1 von 30
It’s Time
Android Wear e Smartwatch:
le app diventano indossabili
Giuseppe Cerratti
Alessandro Mancini
e il Team del GDG Roma L-Ab
Giuseppe Cerratti
giuseppe.ciuffo@gmail.com
it.linkedin.com/in/giuseppecerratti
plus.google.com/+GiuseppeCerratti
Alessandro Mancini
alem1979@gmail.com
it.linkedin.com/in/AleMan79
plus.google.com/+AlessandroMancini13
developer.android.com/wear
“Android wearables provide just the right
information at just the right time, allowing you to
be connected to the virtual world and present in
the real world.”
developer.android.com/wear
Right info
at right time
Design
Principales
The Card
Le Card sono alla base
della UI di Android Wear
Sono molto più che notifiche.
Le Card appaiono solo se invocate
o se strettamente necessarie
all’utente in un certo istante.
developer.android.com/wear
The Card
pattern
App
Laucher Icon
Image
Text
Title
developer.android.com/wear
The Context
Stream
Il Context Stream è
una lista verticale di Card
Nello stream viene visualizzata
una sola Card per volta.
developer.android.com/wear
How can
I use it?!
Plun!
developer.android.com/wear
Official
devices
Motorola
moto360
LG
G Watch
Let’s
Code!
Scarica il codice del codelab
al seguente link:
github.com/GDG-L-Ab/Wearun_ToDo
Code
Caution: The current Android Wear Developer Preview is intended for
development and testing purposes only, not for production apps.
Google may change this Developer Preview significantly prior to the
official release of the Android Wear SDK.
Get the Developer Preview
Tasto destro sulla libreria
-> build path
-> add to build path
Import
android.preview
Wearun/ libs/
Copiare la libreria:
wearable-preview-support.jar
MainActivity.java
import android.preview.support.wearable.notifications.*;
import android.preview.support.v4.app.NotificationManagerCompat;
import android.support.v4.app.NotificationCompat;
Import
android.preview
int notificationId = 001;
NotificationCompat.Builder notifBuilder =
new NotificationCompat.Builder(getApplicationContext())
.setSmallIcon(R.drawable.ic_launcher)
.setContentTitle("Lap Time")
.setContentText("Swipe to save the lap time");
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(getApplicationContext());
notificationManager.notify(notificationId,notifBuilder.build());
Build
notification
Test!
Let’s
Interact
Create intent
reciever
public class NotificationReceiver extends BroadcastReceiver{
public static final String ACTION_START =
"com.giux.wearun.ACTION_START";
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
MainActivity.start();
}
}
<application>
<receiver
android:name="com.giux.wearun.NotificationReceiver"
android:exported="true"
>
<intent-filter>
<action android:name="com.giux.wearun.ACTION_START"/>
<action android:name="com.giux.wearun.ACTION_LAP"/>
<action android:name="com.giux.wearun.ACTION_STOP"/>
</intent-filter>
</receiver>
</application>
Intent &
manifest
Intent intent = new Intent(NotificationReceiver.ACTION_START)
.setClass(getBaseContext(), NotificationReceiver.class);
PendingIntent pending =
PendingIntent.getBroadcast(getBaseContext(), notifId, intent, 0);
…
.addAction(R.drawable.ic_start, "Start", pending );
….
addAction
Test!
Add another
Action!
public class NotificationReceiver extends BroadcastReceiver{
public static final String ACTION_START =
"com.giux.wearun.ACTION_START";
public static final String ACTION_LAP =
"com.giux.wearun.ACTION_LAP";
public static final String ACTION_STOP =
"com.giux.wearun.ACTION_STOP";
Edit the Broadcast
Reciever
@Override
public void onReceive(Context context, Intent intent) {
String action = intent.getAction();
switch (action) {
case ACTION_START:
MainActivity.start();
break;
…
default:
break;
}
Edit the Intent
Reciever
public PendingIntent createIntent(String extra, int notifId){
Intent intent = null;
switch (extra) {
case "start":
intent = new Intent(NotificationReceiver.ACTION_START)
.setClass(getBaseContext(), NotificationReceiver.class);
break;
…
}
PendingIntent pending =
PendingIntent.getBroadcast(getBaseContext(), notifId, intent, 0);
return pending;
}
More Intent
public void notif(){
…
.setContentTitle("Lap Time")
.setContentText("Swipe to save the lap time")
.addAction(R.drawable.ic_start, "Start", createIntent("start", notificationId))
//ToDo
NotificationManagerCompat notificationManager =
NotificationManagerCompat.from(getApplicationContext());
notificationManager.notify(notificationId, notifBuilder.build());
}
More Action
That’s
All!

Weitere ähnliche Inhalte

Ähnlich wie "It's Time" - Android Wear codelab - GDG MeetsU - L'Aquila

Android Evolution, AppForum 2014, Brussels, Friedger Müffke
Android Evolution, AppForum 2014, Brussels, Friedger MüffkeAndroid Evolution, AppForum 2014, Brussels, Friedger Müffke
Android Evolution, AppForum 2014, Brussels, Friedger MüffkeFriedger Müffke
 
Break Timer: Android-wear introduction and application case-study
Break Timer: Android-wear introduction and application case-studyBreak Timer: Android-wear introduction and application case-study
Break Timer: Android-wear introduction and application case-studyUmair Vatao
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...mharkus
 
Introduction to Android Programming
Introduction to Android ProgrammingIntroduction to Android Programming
Introduction to Android ProgrammingRaveendra R
 
Droidcon Turin 2015 - Android wear sdk introduction
Droidcon Turin 2015 - Android wear sdk introductionDroidcon Turin 2015 - Android wear sdk introduction
Droidcon Turin 2015 - Android wear sdk introductionMichelantonio Trizio
 
Android wear SDK introduction
Android wear SDK introductionAndroid wear SDK introduction
Android wear SDK introductionTiziano Basile
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Weargabrielemariotti
 
Android wear and Cardboard
Android wear and CardboardAndroid wear and Cardboard
Android wear and Cardboardmharkus
 
Developing for android wear
Developing for android wearDeveloping for android wear
Developing for android wearThomas Oldervoll
 
Exercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callExercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callmaamir farooq
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android WearPeter Friese
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspectiveGunjan Kumar
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updatedGhanaGTUG
 
Session #8 adding magic to your app
Session #8  adding magic to your appSession #8  adding magic to your app
Session #8 adding magic to your appVitali Pekelis
 
Android Wear, a developer's perspective
Android Wear, a developer's perspectiveAndroid Wear, a developer's perspective
Android Wear, a developer's perspectiveSebastian Vieira
 
Android interview questions and answers
Android interview questions and answersAndroid interview questions and answers
Android interview questions and answerskavinilavuG
 
Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...naseeb20
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android DevelopmentProf. Erwin Globio
 

Ähnlich wie "It's Time" - Android Wear codelab - GDG MeetsU - L'Aquila (20)

Android Evolution, AppForum 2014, Brussels, Friedger Müffke
Android Evolution, AppForum 2014, Brussels, Friedger MüffkeAndroid Evolution, AppForum 2014, Brussels, Friedger Müffke
Android Evolution, AppForum 2014, Brussels, Friedger Müffke
 
Break Timer: Android-wear introduction and application case-study
Break Timer: Android-wear introduction and application case-studyBreak Timer: Android-wear introduction and application case-study
Break Timer: Android-wear introduction and application case-study
 
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
GDG GeorgeTown Devfest 2014 Presentation: Android Wear: A Developer's Perspec...
 
Introduction to Android Programming
Introduction to Android ProgrammingIntroduction to Android Programming
Introduction to Android Programming
 
Droidcon Turin 2015 - Android wear sdk introduction
Droidcon Turin 2015 - Android wear sdk introductionDroidcon Turin 2015 - Android wear sdk introduction
Droidcon Turin 2015 - Android wear sdk introduction
 
Android wear SDK introduction
Android wear SDK introductionAndroid wear SDK introduction
Android wear SDK introduction
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Wear
 
Android wear and Cardboard
Android wear and CardboardAndroid wear and Cardboard
Android wear and Cardboard
 
Developing for android wear
Developing for android wearDeveloping for android wear
Developing for android wear
 
Exercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone callExercises broadcast receiver,incoming phone call
Exercises broadcast receiver,incoming phone call
 
Android Wear Development
Android Wear DevelopmentAndroid Wear Development
Android Wear Development
 
Introduction to Android Wear
Introduction to Android WearIntroduction to Android Wear
Introduction to Android Wear
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
21 android2 updated
21 android2 updated21 android2 updated
21 android2 updated
 
Session #8 adding magic to your app
Session #8  adding magic to your appSession #8  adding magic to your app
Session #8 adding magic to your app
 
Android Wear, a developer's perspective
Android Wear, a developer's perspectiveAndroid Wear, a developer's perspective
Android Wear, a developer's perspective
 
Android Wearable App
Android Wearable AppAndroid Wearable App
Android Wearable App
 
Android interview questions and answers
Android interview questions and answersAndroid interview questions and answers
Android interview questions and answers
 
Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...Implementation of Push Notification in React Native Android app using Firebas...
Implementation of Push Notification in React Native Android app using Firebas...
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 

Kürzlich hochgeladen

Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfStefano Stabellini
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Angel Borroy López
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtimeandrehoraa
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsChristian Birchler
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxRTS corp
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Natan Silnitsky
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfYashikaSharma391629
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecturerahul_net
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf31events.com
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 

Kürzlich hochgeladen (20)

Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
Xen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdfXen Safety Embedded OSS Summit April 2024 v4.pdf
Xen Safety Embedded OSS Summit April 2024 v4.pdf
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
Alfresco TTL#157 - Troubleshooting Made Easy: Deciphering Alfresco mTLS Confi...
 
Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
SpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at RuntimeSpotFlow: Tracking Method Calls and States at Runtime
SpotFlow: Tracking Method Calls and States at Runtime
 
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving CarsSensoDat: Simulation-based Sensor Dataset of Self-driving Cars
SensoDat: Simulation-based Sensor Dataset of Self-driving Cars
 
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptxReal-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
Real-time Tracking and Monitoring with Cargo Cloud Solutions.pptx
 
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
Taming Distributed Systems: Key Insights from Wix's Large-Scale Experience - ...
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdfInnovate and Collaborate- Harnessing the Power of Open Source Software.pdf
Innovate and Collaborate- Harnessing the Power of Open Source Software.pdf
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
Understanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM ArchitectureUnderstanding Flamingo - DeepMind's VLM Architecture
Understanding Flamingo - DeepMind's VLM Architecture
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Sending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdfSending Calendar Invites on SES and Calendarsnack.pdf
Sending Calendar Invites on SES and Calendarsnack.pdf
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 

"It's Time" - Android Wear codelab - GDG MeetsU - L'Aquila