ÉtendresesApplicationsaux
smartwatchesetTVsAndroid™
Xavier Hallade - @ph0b - +XavierHallade
Application Engineer, Intel Corporation
Android
Agenda
Android TV
Les spécificités du système
Adapter et distribuer son application pour Android TV
Android Wear
Les spécificités du système
Des notifications sous stéroïdes
Créer une application native ou une watchface
Q&A
AndroidTV
Android TV
• C’est Android
• Mais aussi Chromecast (Google Cast)
• Applications (multimedia et +)
• Jeux (casual et +)
• AOSP compliant
• Leanback Launcher, Google Apps, Play Store…
• Hardware: equivalent aux tablettes/smartphones de milieu à haut de gamme.
Devices
NVIDIA* Shield
Razer* Forge TV
Smart TVs: Sony*, Philips*, Sharp*, TCL*…
Google* Nexus Player
Demo
Demo
Demo
AdaptersonapplicationpourAndroidTV
Adapter son application pour Android TV
1. Ajouter/réutiliser une activity pour Android TV, pour recevoir l’intent “Leanback”
2. Intégrer des assets spécifiques
3. Supporter la navigation sans couche tactile
4. Adapter l’UI
5. Aller plus loin!
Il n’est pas necessaire de créer une application séparée.
Même si cela reste possible en gardant une seule entrée sur le Play Store.
1. Leanback Intent
<activity android:name=".TvMainActivity" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category
android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
2. Banner
<activity or <application
…
android:banner="@drawable/ic_banner"
…
>
• Inclu le nom localisé de l’application
• Pas de transparence
• Taille:160x90dp -> 320x180px dans drawable-xhdpi
3. Supporter la navigation sans couche tactile
<uses-feature
android:name="android.hardware.touchscreen"
android:required="false" />
Adjust D-PAD navigation:
android:focusable="true", <requestFocus /> / .requestFocus()
android:nextFocusDown="@+id/whatever1"
android:nextFocusUp="@id/whatever2"
For custom Views:
KeyEvent.KEYCODE_DPAD_(UP|DOWN|LEFT|RIGHT|CENTER)
4. Adapting the UI
Démarrer de android:Theme.NoTitleBar
ou Theme.Leanback de la Leanback support library:
compile "com.android.support:leanback-v17:23.1.1"
Ajouter des marges pour l’overscan: (Les Leanback Views et Fragments les ont déjà)
android:layout_marginTop="27dp"
android:layout_marginLeft="48dp"
android:layout_marginRight="48dp"
android:layout_marginBottom="27dp"
* minSdkVersion>=17 est censé être requis pour la Leanback support library, mais il est
possible de passer outre:
• Utiliser Theme.Leanback depuis uniquement des resources –v21+, restreindre l’utilisation
de la librairie aux parties executées uniquement sur TV
• Ajouter au manifest: <uses-sdk
tools:overrideLibrary="android.support.v17.leanback" />
Aller plus loin dans l’intégration
• Pousser des recommendations
• Utiliser les éléments de la Leanback support library
• Supporter plusieurs controleurs
• S’intégrer au système de recherche
• Diffuser du contenu par le “TV Input Framework”
Pousser des recommendations
Bundle extras = new Bundle();
extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, backgroundUri);
Notification notification = new NotificationCompat.BigPictureStyle(
new NotificationCompat.Builder(mContext)
.setLargeIcon(bitmap)
.setColor(color)
.setContentTitle(title)
.setContentText(description)
.setLocalOnly(true)
.setOngoing(true)
.setCategory(Notification.CATEGORY_RECOMMENDATION)
.setSmallIcon(mSmallIcon)
.setContentIntent(mIntent)
.setExtras(extras))
.build();
It’s advised to update recommendations from a service you can trigger using an AlarmManager
that will run it periodically, starting with shorty after boot.
The Leanback support library – BrowseFragment
BackgroundManager.getInstance()
.setDrawable()
setTitle()
setBadgeDrawable()
setAdapter( ObjectAdapter )
Presented items have to be Rows.
setBrandColor()
setSearchAffordanceColor()
setOnSearchClickedListener()
setOnItemViewSelectedListener()
setOnItemViewClickedListener()
setHeadersState()
Supporter plusieurs contrôleurs
• int KeyEvent.getDeviceId()
• String KeyEvent.getDevice().getDescriptor()
API Level 16+
• Nearby Connection API
Google Play Services 7.0+
Système de Recherche
• Global Search
• Implémentez un Content Provider
• Declarez android.app.searchable
• https://developer.android.com/training/
tv/discovery/searchable.html
• Search Activity:
• Utilisez SpeechRecognizer
• Ou directement le Leanback SearchFragment.
TV Input Framework – Live Channels
<service
android:name=".MyTvInputService"
android:permission="android.permission.BIND_TV_INPUT" >
<intent-filter>
<action android:name="android.media.tv.TvInputService" />
</intent-filter>
<meta-data android:name="android.media.tv.input“ android:resource="@xml/my_tv_input" />
</service>
<?xml version="1.0" encoding="utf-8"?>
<tv-input xmlns:android="http://schemas.android.com/apk/res/android"
android:settingsActivity="com.xh.tvinputservicetest.SettingsActivity"
android:setupActivity="com.xh.tvinputservicetest.SetupActivity" />
my_tv_input.xml
AndroidManifest.xml
public class MyTvInputService extends TvInputService {
…
@Override
public Session onCreateSession(String inputId) {
return new MyTvInputServiceSession(MyTvInputService.this); //ServiceSession implementation is on next slide
}
}
TV Input Framework – Live Channels
public class MyTvInputServiceSession extends TvInputService.Session {
Surface mSurface;
@Override
public boolean onSetSurface(Surface surface) {
mSurface = surface;
return true;
}
@Override
public boolean onTune(Uri channelUri) {
notifyVideoUnavailable(TvInputManager.VIDEO_UNAVAILABLE_REASON_BUFFERING);
//tune to channel and change draws to surface in a render thread, then fire notifyVideoAvailable()
return true;
}
@Override
public void onSetCaptionEnabled(boolean enabled) { }
…
}
DistribuersonapplicationAndroidTV
Ajuster son Manifest
Game ?
<application … android:isGame="true" …>
Support des Gamepads ?
<uses-feature android:name="android.hardware.gamepad" android:required="false" />
“features” indisponibles:
android.hardware.location.gps, android.hardware.camera.*, android.hardware.telephony, android.hardware.sensor.*,
android.hardware.nfc, android.hardware.touchscreen, android.hardware.microphone, android.hardware.location
Android TV only ?
<uses-feature android:name="android.software.leanback" android:required="true" />
Soumission
Android TV - résumé
• Le support d’Android TV n’est pas nécessairement compliqué à ajouter.
• Pas besoin de maintenir un APK séparé.
Resources additionnelles:
• Udacity Course: http://bit.ly/1GJ7OyW
• Leanback Support Library Sample: https://github.com/googlesamples/androidtv-Leanback
• TV Input Framework Sample: https://github.com/googlesamples/androidtv-sample-inputs
• ATV Unity Codelab: http://bit.ly/1LNJ6My
• ATV Leanback Codelab: http://bit.ly/1No3rue
• Pie Noon sample: https://github.com/google/pienoon
• Feedback Form: http://bit.ly/20qYaaw
Questions?
AndroidWear
Android Wear
• C’est Android
• Extension au smartphone et à ses applications
• Applications Android natives
• Navigation tactile simple et gestuelle
• PAS dans l’AOSP
• Hardware: equivalent aux smartphones d’entrée de gamme.
• Pas de décodage vidéo, webview, clavier système, ni connexion
directe à Internet
NOTIFICATIONS
Notifications
Marchent automatiquement.
Les améliorer pour Wear = Les améliorer pour Android
 Styles, icônes, priorité, type..
 Groupes
 Actions
Éléments spécifiques à Wear:
 Pages/Remote Input
Tout reste contrôlé et reçu par l’application d’origine.
NotificationCompat.Builder notificationBuilder =
new NotificationCompat.Builder(this)
.setSmallIcon(R.drawable.ic_event)
.setLargeIcon(BitmapFactory.decodeResource(
getResources(), R.drawable.notif_background))
.setContentTitle(eventTitle)
.setContentText(eventLocation)
.setContentIntent(viewPendingIntent)
.addAction(R.drawable.ic_map,
getString(R.string.map), mapPendingIntent)
…
NotificationCompat.Builder
Notifications - actions
NotificationCompat.Builder.addAction()
Notifications - groupes
NotificationCompat.Builder.setGroup(String groupKey)
Réponses complèxes depuis une notification
Texte libre / Emojis
Réponses prédéfinies
android.app.RemoteInput
Notifications – spécique à Android Wear
Notification.WearableExtender.addPage(Notification)
Pagination
Notifications – spécique à Android Wear
Action directe au
touch sur la notification
Notification.WearableExtender.setContentxxx()
Notifications – spécique à Android Wear
Notification.WearableExtender.setBackground()
+ setHintShowBackgroundOnly()
(+ for QR codes: setHintAvoidBackgroundClipping())
Avant d’aller plus loin, pensez l’expérience utilisateur
Qu’est ce que mon application peut apporter à l’utilisateur, à travers Android
Wear?
Notifications
Informations supplémentaires (pages, images, QR code..)
Actions simples
Plus?
-> Action pour ouvrir l’application Android associée
-> Utilisation d’une application Android Wear native
Créeretdistribueruneapplication
nativeouunewatchface
Applications Natives à Android Wear
- Mode de distribution: APK dans l’APK
- Déployé peu après l’installation de l’application sur le téléphone
- Pour le développement: connection directe à l’Émulateur ou smartwatch
dependencies {
compile 'com.google.android.gms:play-services:8.4.0'
compile 'com.android.support:support-v4:23.1.1'
wearApp project(':wearable')
}
Communication Wear App /Android App
Pas d’accès Internet
Solution: Google Play Services
NodeApi, MessageApi, DataApi, ChannelApi
Restez raisonnables sur la quantité et la fréquence des communications.
android.gms.wearable
Penser ses vues pour Android Wear
• Viser une consultation d’environ 5 secondes.
• Permettre une intéraction efficace
• voix, emoji, swipe, tap plein écran
• pas de champs textes ou autre.
• S’adapter aux différents types et tailles d’écrans
Non.
Gérer le mode ambient
• Intéractif: montre en utilisation
• intéractions possibles
• mises à jour en permanence
• Ambient:
• Optionnel
• Une mise à jour par minute par défaut
• Max 20 seconds recommandé
• Possible de faire plus, mais à éviter pour conserver la batterie
Utiliser des éléments prédéfinis
DelayedConfirmationView
ConfirmationActivity
WearableListView
CardFragment
GridViewPager
+DotsPageIndicator
DismissOverlayView
Intéractions vocales
Call a car/taxi "OK Google, get me a taxi“ / "OK Google, call me a car"
Take a note "OK Google, take a note“ / "OK Google, note to self"
Set alarm "OK Google, set an alarm for 8 AM“ / "OK Google, wake me up at 6 tomorrow"
Set timer "Ok Google, set a timer for 10 minutes"
Start stopwatch "Ok Google, start stopwatch"
Start/Stop a bike ride "OK Google, start cycling“ / "OK Google, start my bike ride“ / ”OK Google, stop cycling"
Start/Stop a run "OK Google, track my run“ / "OK Google, start running“ / OK Google, stop running"
Start/Stop a workout "OK Google, start a workout“ / "OK Google, track my workout“ / "OK Google, stop workout"
Show heart rate "OK Google, what’s my heart rate?“ / "OK Google, what’s my bpm?"
Show step count "OK Google, how many steps have I taken?“ / "OK Google, what’s my step count?"
Start your APP “OK Google, start yourApp”
S’adapter aux différents hardware
Écran circulaire w/ chin
LCD
ARMv7 OS
512MB ram
Écran carré
AMOLED
ARMv7 OS
512MB ram
Onboard speaker
Écran circulaire
AMOLED
ARMv7 OS
512MB ram
Écran carré
LCD
Transflectif
ARMv7 OS
Onboard GPS
512MB ram
Écran circulaire
LCD Transflectif
x86 OS
1GB ram
Écran circulaire w/ chin
LCD
x86 OS
1GB ram
Pas de tailles d’écran standard: 320x290px, 360x360px, 360x325px, 360x326px, 400x400px…
Différents types de CPU
Tous les téléphones/tablettes Android basés sur des architectures Intel
peuvent historiquement faire tourner du code ARM… ce n’est pas le cas pour
les smartwatches.
Cela reste rarement un problème:
Les applications Android sont à la base en Java
S’il y a des parties natives (anecdotique pour des applications Wear),
il est normalement simple d’intégrer leur version x86.
Ambient mode
Usually LCD technology
(transflective or not)
Ambient mode
LOW_BIT display
Usually AMOLED technology
Interactive Mode
Différents types d’écrans
Watchfaces
• Identique aux applications natives
• Peut passer une vue pour paramétrer la watchface
• Gestion du mode ambient obligatoire
• Implémente un WatchFaceService
<manifest ...>
<uses-permission
android:name="com.google.android.permission.PROVIDE_BACKGROUND" />
<uses-permission
android:name="android.permission.WAKE_LOCK" />
...
<application …>
<service android:name=".AnalogWatchFaceService" android:label="@string/analog_name" android:allowEmbedded="true“
android:permission="android.permission.BIND_WALLPAPER" >
<meta-data android:name="android.service.wallpaper“ android:resource="@xml/watch_face" />
<meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/preview_analog" />
<meta-data android:name="com.google.android.wearable.watchface.preview_circular" android:resource="@drawable/preview_analog_circular" />
<intent-filter>
<action android:name="android.service.wallpaper.WallpaperService" />
<category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" />
</intent-filter>
</service>
</application>
</manifest>
Watchfaces interactives
Peut gérer le Tap sur toute la surface
Les autres gestes sont réservés au système.
setWatchFaceStyle(new WatchFaceStyle.Builder(mService)
.setAcceptsTapEvents(true)
// other style customizations
.build());
@Override
public void onTapCommand(
@TapType int tapType, int x, int y, long eventTime) {
switch (tapType) {
case WatchFaceService.TAP_TYPE_TAP:
hideTapHighlight();
if (withinTapRegion(x, y)) {
// Implement the tap action
// (e.g. show detailed step count)
onWatchFaceTap();
}
break;
//…
}
}
Android Wear - résumé
Penser, tester et améliorer ses notifications pour Android Wear est relativement simple.
La plateforme permet d’aller beaucoup plus loin si votre application s’y prête.
La distribution est approuvée de la même manière que pour Android TV:
Questions?
xavier.hallade@intel.com - @ph0b - +XavierHallade

Etendre ses applications aux smartwatches et TVs android

  • 1.
    ÉtendresesApplicationsaux smartwatchesetTVsAndroid™ Xavier Hallade -@ph0b - +XavierHallade Application Engineer, Intel Corporation
  • 2.
  • 3.
    Agenda Android TV Les spécificitésdu système Adapter et distribuer son application pour Android TV Android Wear Les spécificités du système Des notifications sous stéroïdes Créer une application native ou une watchface Q&A
  • 4.
  • 5.
    Android TV • C’estAndroid • Mais aussi Chromecast (Google Cast) • Applications (multimedia et +) • Jeux (casual et +) • AOSP compliant • Leanback Launcher, Google Apps, Play Store… • Hardware: equivalent aux tablettes/smartphones de milieu à haut de gamme.
  • 6.
    Devices NVIDIA* Shield Razer* ForgeTV Smart TVs: Sony*, Philips*, Sharp*, TCL*… Google* Nexus Player
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
    Adapter son applicationpour Android TV 1. Ajouter/réutiliser une activity pour Android TV, pour recevoir l’intent “Leanback” 2. Intégrer des assets spécifiques 3. Supporter la navigation sans couche tactile 4. Adapter l’UI 5. Aller plus loin! Il n’est pas necessaire de créer une application séparée. Même si cela reste possible en gardant une seule entrée sur le Play Store.
  • 12.
    1. Leanback Intent <activityandroid:name=".TvMainActivity" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity>
  • 13.
    2. Banner <activity or<application … android:banner="@drawable/ic_banner" … > • Inclu le nom localisé de l’application • Pas de transparence • Taille:160x90dp -> 320x180px dans drawable-xhdpi
  • 14.
    3. Supporter lanavigation sans couche tactile <uses-feature android:name="android.hardware.touchscreen" android:required="false" /> Adjust D-PAD navigation: android:focusable="true", <requestFocus /> / .requestFocus() android:nextFocusDown="@+id/whatever1" android:nextFocusUp="@id/whatever2" For custom Views: KeyEvent.KEYCODE_DPAD_(UP|DOWN|LEFT|RIGHT|CENTER)
  • 15.
    4. Adapting theUI Démarrer de android:Theme.NoTitleBar ou Theme.Leanback de la Leanback support library: compile "com.android.support:leanback-v17:23.1.1" Ajouter des marges pour l’overscan: (Les Leanback Views et Fragments les ont déjà) android:layout_marginTop="27dp" android:layout_marginLeft="48dp" android:layout_marginRight="48dp" android:layout_marginBottom="27dp" * minSdkVersion>=17 est censé être requis pour la Leanback support library, mais il est possible de passer outre: • Utiliser Theme.Leanback depuis uniquement des resources –v21+, restreindre l’utilisation de la librairie aux parties executées uniquement sur TV • Ajouter au manifest: <uses-sdk tools:overrideLibrary="android.support.v17.leanback" />
  • 16.
    Aller plus loindans l’intégration • Pousser des recommendations • Utiliser les éléments de la Leanback support library • Supporter plusieurs controleurs • S’intégrer au système de recherche • Diffuser du contenu par le “TV Input Framework”
  • 17.
    Pousser des recommendations Bundleextras = new Bundle(); extras.putString(Notification.EXTRA_BACKGROUND_IMAGE_URI, backgroundUri); Notification notification = new NotificationCompat.BigPictureStyle( new NotificationCompat.Builder(mContext) .setLargeIcon(bitmap) .setColor(color) .setContentTitle(title) .setContentText(description) .setLocalOnly(true) .setOngoing(true) .setCategory(Notification.CATEGORY_RECOMMENDATION) .setSmallIcon(mSmallIcon) .setContentIntent(mIntent) .setExtras(extras)) .build(); It’s advised to update recommendations from a service you can trigger using an AlarmManager that will run it periodically, starting with shorty after boot.
  • 18.
    The Leanback supportlibrary – BrowseFragment BackgroundManager.getInstance() .setDrawable() setTitle() setBadgeDrawable() setAdapter( ObjectAdapter ) Presented items have to be Rows. setBrandColor() setSearchAffordanceColor() setOnSearchClickedListener() setOnItemViewSelectedListener() setOnItemViewClickedListener() setHeadersState()
  • 19.
    Supporter plusieurs contrôleurs •int KeyEvent.getDeviceId() • String KeyEvent.getDevice().getDescriptor() API Level 16+ • Nearby Connection API Google Play Services 7.0+
  • 20.
    Système de Recherche •Global Search • Implémentez un Content Provider • Declarez android.app.searchable • https://developer.android.com/training/ tv/discovery/searchable.html • Search Activity: • Utilisez SpeechRecognizer • Ou directement le Leanback SearchFragment.
  • 21.
    TV Input Framework– Live Channels <service android:name=".MyTvInputService" android:permission="android.permission.BIND_TV_INPUT" > <intent-filter> <action android:name="android.media.tv.TvInputService" /> </intent-filter> <meta-data android:name="android.media.tv.input“ android:resource="@xml/my_tv_input" /> </service> <?xml version="1.0" encoding="utf-8"?> <tv-input xmlns:android="http://schemas.android.com/apk/res/android" android:settingsActivity="com.xh.tvinputservicetest.SettingsActivity" android:setupActivity="com.xh.tvinputservicetest.SetupActivity" /> my_tv_input.xml AndroidManifest.xml public class MyTvInputService extends TvInputService { … @Override public Session onCreateSession(String inputId) { return new MyTvInputServiceSession(MyTvInputService.this); //ServiceSession implementation is on next slide } }
  • 22.
    TV Input Framework– Live Channels public class MyTvInputServiceSession extends TvInputService.Session { Surface mSurface; @Override public boolean onSetSurface(Surface surface) { mSurface = surface; return true; } @Override public boolean onTune(Uri channelUri) { notifyVideoUnavailable(TvInputManager.VIDEO_UNAVAILABLE_REASON_BUFFERING); //tune to channel and change draws to surface in a render thread, then fire notifyVideoAvailable() return true; } @Override public void onSetCaptionEnabled(boolean enabled) { } … }
  • 23.
  • 24.
    Ajuster son Manifest Game? <application … android:isGame="true" …> Support des Gamepads ? <uses-feature android:name="android.hardware.gamepad" android:required="false" /> “features” indisponibles: android.hardware.location.gps, android.hardware.camera.*, android.hardware.telephony, android.hardware.sensor.*, android.hardware.nfc, android.hardware.touchscreen, android.hardware.microphone, android.hardware.location Android TV only ? <uses-feature android:name="android.software.leanback" android:required="true" />
  • 25.
  • 26.
    Android TV -résumé • Le support d’Android TV n’est pas nécessairement compliqué à ajouter. • Pas besoin de maintenir un APK séparé. Resources additionnelles: • Udacity Course: http://bit.ly/1GJ7OyW • Leanback Support Library Sample: https://github.com/googlesamples/androidtv-Leanback • TV Input Framework Sample: https://github.com/googlesamples/androidtv-sample-inputs • ATV Unity Codelab: http://bit.ly/1LNJ6My • ATV Leanback Codelab: http://bit.ly/1No3rue • Pie Noon sample: https://github.com/google/pienoon • Feedback Form: http://bit.ly/20qYaaw Questions?
  • 27.
  • 28.
    Android Wear • C’estAndroid • Extension au smartphone et à ses applications • Applications Android natives • Navigation tactile simple et gestuelle • PAS dans l’AOSP • Hardware: equivalent aux smartphones d’entrée de gamme. • Pas de décodage vidéo, webview, clavier système, ni connexion directe à Internet
  • 29.
  • 30.
    Notifications Marchent automatiquement. Les améliorerpour Wear = Les améliorer pour Android  Styles, icônes, priorité, type..  Groupes  Actions Éléments spécifiques à Wear:  Pages/Remote Input Tout reste contrôlé et reçu par l’application d’origine. NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setSmallIcon(R.drawable.ic_event) .setLargeIcon(BitmapFactory.decodeResource( getResources(), R.drawable.notif_background)) .setContentTitle(eventTitle) .setContentText(eventLocation) .setContentIntent(viewPendingIntent) .addAction(R.drawable.ic_map, getString(R.string.map), mapPendingIntent) … NotificationCompat.Builder
  • 31.
  • 32.
  • 33.
    Réponses complèxes depuisune notification Texte libre / Emojis Réponses prédéfinies android.app.RemoteInput
  • 34.
    Notifications – spéciqueà Android Wear Notification.WearableExtender.addPage(Notification) Pagination
  • 35.
    Notifications – spéciqueà Android Wear Action directe au touch sur la notification Notification.WearableExtender.setContentxxx()
  • 36.
    Notifications – spéciqueà Android Wear Notification.WearableExtender.setBackground() + setHintShowBackgroundOnly() (+ for QR codes: setHintAvoidBackgroundClipping())
  • 37.
    Avant d’aller plusloin, pensez l’expérience utilisateur Qu’est ce que mon application peut apporter à l’utilisateur, à travers Android Wear? Notifications Informations supplémentaires (pages, images, QR code..) Actions simples Plus? -> Action pour ouvrir l’application Android associée -> Utilisation d’une application Android Wear native
  • 38.
  • 39.
    Applications Natives àAndroid Wear - Mode de distribution: APK dans l’APK - Déployé peu après l’installation de l’application sur le téléphone - Pour le développement: connection directe à l’Émulateur ou smartwatch dependencies { compile 'com.google.android.gms:play-services:8.4.0' compile 'com.android.support:support-v4:23.1.1' wearApp project(':wearable') }
  • 40.
    Communication Wear App/Android App Pas d’accès Internet Solution: Google Play Services NodeApi, MessageApi, DataApi, ChannelApi Restez raisonnables sur la quantité et la fréquence des communications. android.gms.wearable
  • 41.
    Penser ses vuespour Android Wear • Viser une consultation d’environ 5 secondes. • Permettre une intéraction efficace • voix, emoji, swipe, tap plein écran • pas de champs textes ou autre. • S’adapter aux différents types et tailles d’écrans Non.
  • 42.
    Gérer le modeambient • Intéractif: montre en utilisation • intéractions possibles • mises à jour en permanence • Ambient: • Optionnel • Une mise à jour par minute par défaut • Max 20 seconds recommandé • Possible de faire plus, mais à éviter pour conserver la batterie
  • 43.
    Utiliser des élémentsprédéfinis DelayedConfirmationView ConfirmationActivity WearableListView CardFragment GridViewPager +DotsPageIndicator DismissOverlayView
  • 44.
    Intéractions vocales Call acar/taxi "OK Google, get me a taxi“ / "OK Google, call me a car" Take a note "OK Google, take a note“ / "OK Google, note to self" Set alarm "OK Google, set an alarm for 8 AM“ / "OK Google, wake me up at 6 tomorrow" Set timer "Ok Google, set a timer for 10 minutes" Start stopwatch "Ok Google, start stopwatch" Start/Stop a bike ride "OK Google, start cycling“ / "OK Google, start my bike ride“ / ”OK Google, stop cycling" Start/Stop a run "OK Google, track my run“ / "OK Google, start running“ / OK Google, stop running" Start/Stop a workout "OK Google, start a workout“ / "OK Google, track my workout“ / "OK Google, stop workout" Show heart rate "OK Google, what’s my heart rate?“ / "OK Google, what’s my bpm?" Show step count "OK Google, how many steps have I taken?“ / "OK Google, what’s my step count?" Start your APP “OK Google, start yourApp”
  • 45.
    S’adapter aux différentshardware Écran circulaire w/ chin LCD ARMv7 OS 512MB ram Écran carré AMOLED ARMv7 OS 512MB ram Onboard speaker Écran circulaire AMOLED ARMv7 OS 512MB ram Écran carré LCD Transflectif ARMv7 OS Onboard GPS 512MB ram Écran circulaire LCD Transflectif x86 OS 1GB ram Écran circulaire w/ chin LCD x86 OS 1GB ram Pas de tailles d’écran standard: 320x290px, 360x360px, 360x325px, 360x326px, 400x400px…
  • 46.
    Différents types deCPU Tous les téléphones/tablettes Android basés sur des architectures Intel peuvent historiquement faire tourner du code ARM… ce n’est pas le cas pour les smartwatches. Cela reste rarement un problème: Les applications Android sont à la base en Java S’il y a des parties natives (anecdotique pour des applications Wear), il est normalement simple d’intégrer leur version x86.
  • 47.
    Ambient mode Usually LCDtechnology (transflective or not) Ambient mode LOW_BIT display Usually AMOLED technology Interactive Mode Différents types d’écrans
  • 48.
    Watchfaces • Identique auxapplications natives • Peut passer une vue pour paramétrer la watchface • Gestion du mode ambient obligatoire • Implémente un WatchFaceService <manifest ...> <uses-permission android:name="com.google.android.permission.PROVIDE_BACKGROUND" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> ... <application …> <service android:name=".AnalogWatchFaceService" android:label="@string/analog_name" android:allowEmbedded="true“ android:permission="android.permission.BIND_WALLPAPER" > <meta-data android:name="android.service.wallpaper“ android:resource="@xml/watch_face" /> <meta-data android:name="com.google.android.wearable.watchface.preview" android:resource="@drawable/preview_analog" /> <meta-data android:name="com.google.android.wearable.watchface.preview_circular" android:resource="@drawable/preview_analog_circular" /> <intent-filter> <action android:name="android.service.wallpaper.WallpaperService" /> <category android:name="com.google.android.wearable.watchface.category.WATCH_FACE" /> </intent-filter> </service> </application> </manifest>
  • 49.
    Watchfaces interactives Peut gérerle Tap sur toute la surface Les autres gestes sont réservés au système. setWatchFaceStyle(new WatchFaceStyle.Builder(mService) .setAcceptsTapEvents(true) // other style customizations .build()); @Override public void onTapCommand( @TapType int tapType, int x, int y, long eventTime) { switch (tapType) { case WatchFaceService.TAP_TYPE_TAP: hideTapHighlight(); if (withinTapRegion(x, y)) { // Implement the tap action // (e.g. show detailed step count) onWatchFaceTap(); } break; //… } }
  • 50.
    Android Wear -résumé Penser, tester et améliorer ses notifications pour Android Wear est relativement simple. La plateforme permet d’aller beaucoup plus loin si votre application s’y prête. La distribution est approuvée de la même manière que pour Android TV:
  • 51.