xamarin y microsoft azure

30
Xamarin y Azure

Upload: josue-yeray-julian-ferreiro

Post on 18-Jul-2015

680 views

Category:

Software


2 download

TRANSCRIPT

Xamarin y Azure

Josué Yeray Windows XAML Freelance Developer

Microsoft MVP Windows Platform Development

• Blog: http://geeks.ms/blogs/jyeray

• Twitter: @JosueYeray

01Azure Mobile Services

Azure Mobile Services

01Azure Mobile Services

Un backend para todos nuestros dispositivos

SDKs para Windows, Windows Phone, iOS, Android,Cordova y Xamarin

Autenticación integrada con Facebook, Twitter, Live,Google and AAD

Base de datos SQL, MongoDB o Azure Storage tables

Azure Mobile Services

01Azure Mobile Services

Backend en .NET o Javascript

1

Azure Mobile Services

01Azure Mobile Services

Storage

Logic

Scheduler

Authentication

Azure Mobile Services - Xamarin

01Azure Mobile Services

Soporte para Xamarin y Xamarin Forms

Librerías NuGet compartidas

Componentes Xamarin por plataforma

El código de acceso a datos, es totalmente compartido

Mismo código en Xamarin y Xamarin Forms.

Azure Mobile Services

01Azure Mobile Services

Dashboard de actividad

AMS & Xamarin –Tips & Tricks

01Azure Mobile Services

CurrentPlatform.Init al iniciar la app en iOS y Android

La primera llamada tarda unos segundos en realizarse

MobileServiceClient es IDisposable

Si vuestro Backend devuelve URL a imágenes, cuidado!

01Azure Mobile Services

DEMO TIME

02Azure Notifications Hub

02Notifications Hub

Azure Notifications HubNotificaciones Push a dispositivos iOS, Android, WP, Win8

API unificada, una sola llamada para notificar a todos

Aporta telemetría sobre las notificaciones

7

02Notifications Hub

Azure Notifications Hub

7

02Notifications Hub

Azure Notifications Hub

7

02

Azure Notifications Hub – Primer paso

Necesitaremos registrar nuestra app en cadaplataforma

Apple DeveloperGoogle DeveloperWindows StoreWindows Phone Store

Cada una nos dará un certificado/token queconfiguraremos en nuestro Notifications Hub

7Notifications Hub

802

Windows Universal apps

Asociamos la aplicación con una identidad de lastore

Vamos a la web de Servicios live de nuestra app

Obtenemos el SID del paquete y la clave secreta decliente

Estos valores son los mismos para Phone y Store

Notifications Hub

802

Windows Universal appsEn el portal de Administración de Azure creamos unNuevo ServiceBus de tipo Notifications Hub.

Notifications Hub

802

Windows Universal appsUna vez creado, añadimos las credenciales denuestra app:

Notifications Hub

802

Android appsconsole.developer.google.comCreamos un nuevo proyectoHabilitamos “GoogleCloud messaging forAndroid”

Notifications Hub

802

Android appsEn Credentials creamos una nueva clave pública deservidor

Notifications Hub

802

Android appsPor último guardamos esta key en NotificationsHub

Notifications Hub

802

iOS appsEl proceso es más complejo, tenemos que tener unacuenta de pago de desarrollador apple

Generamos un archivo de certificado digital

Subimos este certificado digital a nuestro servicio:

Notifications Hub

02

Connection Strings

Cuando ya hemos añadido todas las plataformas,obtenemos las cadenas de conexión:

Desde el dashboard del hub, link “connection strings”

Usaremos estas para conectar desde las aplicaciones.

10Notifications Hub

02

Código

Una vez que ya hemos terminado la configuración,tenemos que añadir código a cada plataforma paraobtener el canal de notificación.

Cada aplicación ejecutará código en su startup paraobtener y registrar los canales necesarios.

10Notifications Hub

02

REGISTRANDO WINDOWS UNIVERSAL

Usamos el paquete WindowsAzure.Messaging.Managed

Habilitamos notificaciones toast en Package.appxmanifest

En la clase App.xaml.cs registramos las notificaciones.

7Notifications Hub

02

REGISTRANDO ANDROID

Instalamos el componente Google Cloud Message client de Xamarin

Añadimos el paquete Xamarin.NotificationHub

Registramos el ID de Proyecto de GoogleAPI en la FirstView.cs

Creamos una clase de broadcasting que recibirá y mostrará notificaciones

7Notifications Hub

02

REGISTRANDO iOS

Instalamos el componente Azure Mobile Service de Xamarin

Añadimos referencia a Xamarin.NotificationHub que descargamos con Android.

Editamos la clase AppDelegate para registrar las notificaciones

7Notifications Hub

02

DEMO TIME

7Notifications Hub

Josué Yeray Windows XAML Freelance Developer

Microsoft MVP Windows Platform Development

• Blog: http://geeks.ms/blogs/jyeray

• Twitter: @JosueYeray

GRACIAS!!

Ven a conocer nuestras oficinas:Avenida de Manoteras 38 – Oficina C31128050 Madrid

Con Bravent tendrás proyectos cercanos. Conseguirás triunfos globales

Contacta con nosotros:

Llámanos:91 240 4785

Envíanos un e-mail:[email protected]@bravent.net

Visita nuestra web:www.bravent.net

Síguenos en twitter:@bravent

13