Top Banner
Desarrollo Microsoft Band Utilizando Xamarin Javier Suárez
35

Desarrollo para Microsoft Band con Xamarin

Apr 13, 2017

Download

Mobile

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript

Desarrollo Microsoft BandUtilizando XamarinJavier Surez

SVQXDGJavier Surez RuizDeveloper Plain ConceptsMicrosoft MVP Windows Platform DevelopmentXamarin Certified Developer

Blog: http://geeks.ms/blogs/jsuarezEmail: [email protected]: @jsuarezruiz

SVQXDG

2013 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries.The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.9/14/20152

Microsoft Band?La BandSaludProductividadMicrosoft Band Xamarin SDKConectandoSensoresTiles y notificacionesWeb TilesQu son?Creando Web Tiles

Agenda

SVQXDGMicrosoft Band

SVQXDGMicrosoft Band

Dispositivo mvil conectado (wearable) con los siguientes pilares:SaludSer ms productivoPermanecer conectadoPotente a nivel tecnolgico:10 sensoresPantalla tctilBatera media para dos das completos

10Gyroscope

10

SVQXDG

5

Salud & FitnessMide nmero de pasos realizadosNivel de actividad, pulsaciones y patrones de sueoCaloras, distancia, UV, corer, bicicleta, etc.Duracin y eficacia del sueo, nmero de veces que despiertas, ritmo cardiaco.Guas con actividades y rutinas.

SVQXDGProductividad

Notificaciones.Llamadas perdidas, mensajes, el tiempo, twitter y ms.Alertas de calendario y previews de correos.Cortana.

SVQXDG

Integracin con telfonos

SVQXDG

Microsoft Band Xamarin SDK

SVQXDGNos permite integrar Apps con la Microsoft BandTrataremos la Band como algo programmableTrabajaremos con el namespace Microsoft.Band.Portable, IBandClient representar una Band3 grandes vas para interactuarObtener informacin de sensoresCrear tilesPersonalizarNo se ejecuta cdigo de Apps directamente en la BandLa Band ofrece un modelo de extension, no una plataforma de appsSe require una App para telfono/Tablet/PC Usaremos la Band para obtener informacin (sensors) y como pantalla auxiliarMicrosoft Band Xamarin SDKConjunto de libreras y components que permiten extender nuestras Apps integrndolas con la Microsoft Band.

SVQXDG

Build 2014 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.9/14/201510

Conectando con la Bandprivate async Task LoadBands() { Bands = new ObservableCollection(); // Get paired Bands IEnumerable bands = await BandClientManager.Instance.GetPairedBandsAsync(); foreach (var band in bands) { Bands.Add(band); } }

await BandClientManager.Instance.ConnectAsync(BandInfo);

SVQXDG

Build 2014 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.9/14/201511

Conectando con la Band

DEMODEMODEMO

SVQXDGNos suscribimos a eventos de sensoresRecibimos informacin en eventosValores Raw y decimales

Obteniendo informacin de sensores

SVQXDGTipos de sensoresUsamos bandClient.SensorManager

El telfono debe esta conectado para recibir informacin de sensors. Adems, algunos sensores pedirn consentimiento explcito.En tiempos prolongados recibiendo informacin, tiene impacto en la batera.SensorDetallesFrecuenciaRitmo cardiacoNmero de pulsaciones/min1HzAcelermetroX, Y y Z de la aceleracin en gs8/30/60 HzGiroscopioX, Y y Z de la velocidad angular en grados/segundos8/30/60 HzDistanciaDistancia total en cm, velocidad en cm/s, estado, etc1HzPedmetroNmero total de pasosEl valor oscilaTemperatura pielTemperatura actual de la piel1HzUVIntensidad de radiacin UV expuesta1HzContactoEstado de la BandEl valor oscilaCalorasNmero total de calorasEl valor oscila

SVQXDGTrabajando con sensoresvar sensorManager = BandClient.SensorManager;

// Get Distance Dataawait _sensorManager.Distance.StartReadingsAsync(BandSensorSampleRate.Ms128);sensorManager.Distance.ReadingChanged += (s, e) =>{ TotalDistance = e.SensorReading.TotalDistance; var speed = e.SensorReading.Speed; var pace = e.SensorReading.Pace; var currentmotion = e.SensorReading.CurrentMotion;};

SVQXDG

Build 2014 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.9/14/201515

Trabajando con sensores

DEMODEMODEMO

SVQXDGCreando tilesUsaremosbandClient.TileManager

Las Apps pueden crear uno ms tiles.Cada Tile cuenta con GUID e Icono. Hasta 8 iconos adicionales para usar en las pginas.Cada Tile puede tener hasta 8 pginas.Viewport del contenido de la pgina es de 245 x 106 pixels.Las pginas muestran un mensaje genrico o usan custom layouts.

SVQXDGCreando tiles// Create Tilevar tile = new BandTile(TileId){ Icon = TileIcon, Name = TileName, SmallIcon = TileBadge, IsScreenTimeoutDisabled = DisableScreenTimeout};

// Add Tileawait _tileManager.AddTileAsync(tile);

SVQXDG

Build 2014 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.9/14/201518

NotificacionesUsaremos bandClient.NotificationManagerTenemos 3 tipos de notificacionesMensajes. Cuentan con ttulo y cuerpo. Cola tipo FIFO de hasta 8 mensajes a la vez.Dilogos. Mensajes tipo Pop up que no persisten dentro del tile. Alertas Hpticas. De tipo vibracin.

SVQXDGCustom layoutsUsaremos Microsoft.Band.Portable.Tiles.PagesPageLayoutEl Tile puede registrar hasta 5 layouts.Es un rbol de contenedores y elementos.Los contenedores pueden tener uno o ms contenedores o elementos.Los elementos contienen contenido.Cada element soporta padding, etc.ContenedoresElementosFlowPanelTextBlockScrollFlowPanelWrappedTextBlockFilledPanelIconBarcodeTextButtonFilledButton

SVQXDGEnviando pginas usando custom layoutsUsaremos Microsoft.Band.Portable.Tiles.PagesPageDataGUID de Tile + GUID de pgina + ID de elemento.Elegimos layout y especificamos contenido para cada elemento. Aadimos nuevas pginas o actualizamos las existentes basndonos en su GUID.Tipo de ElementoContenidoTextBlockStringWrappedTextBlockString IconIcono (0-9)BarcodeString y barcode a renderizarTextButtonStringFilledButtonColor a mostrar cuando el botn se pulsa

SVQXDGEventos de tilesUsaremos Microsoft.Band.Portable.Tiles.EventsIBandTileEvent, IBandTileEventArgs

Cada tile cuenta con 3 eventos:Tile OpenedTile ClosedButton Pressed

SVQXDGTrabajando con Tiles

DEMODEMODEMO

SVQXDGCambiar la imagen Me Tile

Cambiar el color del tema de la Microsoft Band

Personalizacin

SVQXDG

Personalizacinusing Microsoft.Band.Portable.PersonalizationbandClient.PersonalizationManager

Podemos obtener y establecer la imagen MeTile 310x102 pixelsEl tema de la Band se compone de 6 colores diferentes usados en los diferentes estados

SVQXDGPersonalizacinMeTileImage = await ResourcesHelper.LoadBandImageFromResourceAsync("Resources/metile.png");await personalizationManager.SetMeTileImageAsync(MeTileImage)

await _personalizationManager.SetThemeAsync(new BandTheme{ Base = Base, HighContrast = HighContrast, Highlight = Highlight, Lowlight = Lowlight, Muted = Muted, SecondaryText = SecondaryText});

SVQXDG

Build 2014 2014 Microsoft Corporation. All rights reserved. Microsoft, Windows, and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.9/14/201526

Personalizando la Band

DEMODEMODEMO

SVQXDGMicrosoft Band Web tilesUsaremos Microsoft Health para enviar a la Microsoft Band

Microsoft Health permite conectar con la BandContenido de internetSe especifica contenido y formatoPorque?Fcil de crearSimpleOtra va para atraer usuarios

Para quien?Desarrolladores con contenido web que quieran llegar a la band

SVQXDGCrea facilmente tilesData source, layout, bindingsPublicaHosted/StoredComparteSocial/Email/WebLa App Health se encarga del resto Instalar, actualizar, etc.Web Tile

Spanish wordpedir:[Spanish] pedir[English] to order

SVQXDGWeb Tile packageWeb tile package (*.webtile)manifest.jsonImagenesCustom layoutsJavaScript event handlersArchivo zip que contiene:Manifesto. Describe al tile y su Fuente de informacin.Imgenes. Usadas en iconos del tile.Custom layouts. Archivos JavaScript. Event handling.

SVQXDGCreando Web Tiles

DEMODEMODEMO

SVQXDGInformacin almacenada de los sensores de la Band y otros dispositivosAccede y hace tracking del historial fitness del usuarioColecciones de datos de histricosSe puede contribuir con datos de Microsoft HealthMicrosoft Health APIsPlataforma abierta con APIs RESTful que permiten a los desarrolladores crear Apps basadas en informacin fitness.

SVQXDGInformacin del usuarioSensoresResumenes Diarios, semanales, mensuales de pasos, caloras, distancia, ritmo cardiaco, etcActividades Correr, bicicleta Tracking del sueo eficacia, duracin, etcDispositivos conectadosMicrosoft Health APIs

SVQXDGPreguntas y respuestas.Dudas?P&R

SVQXDG

34

Desarrollo para Microsoft Band con XamarinSVQXDGJavier Surez

SVQXDG

35