Visual Studio Technologies & Windows Platform Development MVP
Xamarin MVP
Xamarin Team Lead at Plain Concepts
• Blog: http://geeks.ms/blogs/jsuarez
• Email: [email protected]
• Twitter: @jsuarezruiz
Apps de calidad
La media de apps que un usuario instala en su
teléfono es de 36 apps.
Sólo 1/4 son usadas diariamente:
1/4 de las apps nunca son usadas!
¿Siempre conectados?
http://opensignal.com/coverage-maps
OPCIONES
AZURE
Código base C# • 100% acceso a APIs nativas • Rendimiento alto
iOS C# UI Windows C# UIAndroid C# UI
Shared C# Mobile C# Server
Linux/Mono
CoreCLRAzure
Shared C# Client/Server
+ servicios de Backend
Web Apps
MobileApps
APIManagement
APIApps
LogicApps
NotificationHubs
Content DeliveryNetwork (CDN)
MediaServices
HDInsight MachineLearning
StreamAnalytics
DataFactory
EventHubs
MobileEngagement
BiztalkServices
HybridConnections
ServiceBus
StorageQueues
Backup
StorSimple
SiteRecovery
Import/Export
SQLDatabase
DocumentDB
RedisCache
Search
Tables
SQL DataWarehouse
Azure AD Connect Health
AD PrivilegedIdentity Mngt
OperationalInsights
CloudServices
Batch Remote App
ServiceFabric Visual Studio
ApplicationInsights
Azure SDK
Team Project
ActiveDirectory
Multi-FactorAuthentication
Automation
Portal
Key Vault
Store /Marketplace
VM Image Gallery& VM Depot
SEGURIDAD & GESTIÓN SERVICIOS DE PLATAFORMA
OPERACIONES HÍBRIDAS
Azure Mobile Apps
REST A
PI
Offline sync
Facebook Twitter Microsoft Google Azure Active Directory
AZURE MOBILE APPS
WindowsAndroidChrome
iOS OSX
In-AppKindle
Backend
SQL MongoTables O365 API Apps
Offline Sync
Crear un Mobile Service
MobileService = new MobileServiceClient(
"https://myapp.azurewebsites.net");
Crear TablasIMobileServiceSyncTable<Store> table;
public async Task Init()
{
const string path = "syncstore.db";
var db = new MobileServiceSQLiteStore(path);
db.DefineTable<Store>();
}
var handler = new MobileServiceSyncHandler();
await MobileService.SyncContext.InitializeAsync(db, h);
table = MobileService.GetSyncTable<Store>();
Obtener y modificar los datospublic async Task<IEnumerable<Store>> GetStoresAsync()
{
await table.PullAsync("allStores", table.CreateQuery());
return await table.ToEnumerableAsync();
}
public async Task<Store> AddStoreAsync (Store store){
await table.InsertAsync (store);await table.PullAsync("allStores", table.CreateQuery());await MobileService.SyncContext.PushAsync();return store;
}
Vamos a añadir un backend!
Shared C# codebase • 100% native API access • High performance
iOS C# UI Windows C# UIAndroid C# UI
Shared C# Mobile C# Server
Linux/Mono
CoreCLRAzure
Shared C# Client/Server
+ SERVER
Autenticación
AUTENTICACIÓN EN AZURE
Azure utiliza OAuth para identificar usuarios móviles. Oauth
define como interactuán entre sí tres participantes para llevar
a cabo el proceso de autenticación:
• Cliente (App Xamarin)
• Azure
• Proveedor de identidad (Idp)
PROVEEDORES DE IDENTIDAD DE TERCEROSAzure soporta la autenticación utilizando diferentes
proveedores de identidad de terceros.
PROVEEDORES DE IDENTIDAD
Azure también soporta utilizar Azure Active Directory.
Podemos utilizar esta opción para realizar autenticación
empresarial.
También es posible utilizar Azure Active Directory B2C que
permite utilizar usuario/contraseña en un almacenamiento
Azure.
PROVEEDORES DE IDENTIDAD
También se puede realizar la integración con proveedores de
identidad personalizdos.
EL FLUJO DE AUTENTICACIÓN
1. El cliente utiliza un WebView para mostrar la página
de Login
2. Azure redirecciona a la página de Login correcta para
cada IdP (Twitter, Facebook, etc.)
3. El usuario se autentica con sus credenciales en el IdP.
4. El IdP redirecciona con un Token.
5. Se valida el Token con Azure y finalmente llega al
cliente.
Notificaciones Push
NOTIFICACIONES PUSH
• Las notificaciones Push nos ofrecen
una vía de comunicación directa con
los clientes de aplicaciones móviles
incluso cuando no esten con la
aplicación abierta.
• Las notificaciones Push se envían
utilizando estructuras específicas de
cada plataforma llamadas Platform
Notification Systems (PNS).
Back-
end
PN
S
Device
1
2
3
4
Comunicación con PNS
Gestión de PNS
Envía notificación
Enviar al dispositivo
NOTIFICACIONES PUSH
• Gestión de
usuarios
• Dependencia con
plataforma
• Escalabilidad
• Monitorización
• Telemetría
AZURE NOTIFICATIONS HUB
Las claves:
• Fácil de utilizar, multiplataforma, infraestructura
escalable
• Envía notificaciones push a cada plataforma
utilizando platform notification services (PNS)
AZURE NOTIFICATIONS HUB
Soporte a gran variedad de PNS
Windows Notification Service
Microsoft Push Notification Service
Apple Push Notification Service
Firebase Cloud Messaging
Google Cloud Messaging
Baidu Cloud Push
Amazon Device Messaging
Se soporta una gran variedad de
dispositivos
Windows Phones, Tablets & PCs con Windows 8
o 10
iOS
Chrome Apps
Android
Amazon Kindles
AZURE NOTIFICATIONS HUB
Android
IPhone
Notification
HubsGCM
Windows PhoneWNS
APNS
Your Application
Sync ficheros
One more thing…
Sync Offline
Online vs Offline
Los dispositivos móviles a menudo pasan por diferentes
estados y condiciones que afectan a las aplicaciones. Entre el
cambio de estado más habitual se encuentra la falta de
acceso a internet.
Como desarrolladores, debemos decider si nuestra aplicación
deja de funcionar offline (no permite el acceso a apartados,
etc.) o bien si se añade una cache offline que permita seguir
trabajando.
Sincronización Offline
Azure permite la sincronización offline de los datos con
pocas líneas de código.
Los beneficios:
• Permite el acceso a la información sin red.
• Sincronización automática de datos con cache local.
• Control sobre cuándo se realiza la sincronización.