+ All Categories
Home > Mobile > Petr Dvořák: Push notifikace ve velkém

Petr Dvořák: Push notifikace ve velkém

Date post: 16-Feb-2017
Category:
Upload: mdevtalk
View: 205 times
Download: 0 times
Share this document with a friend
80
Transcript
Page 1: Petr Dvořák: Push notifikace ve velkém
Page 2: Petr Dvořák: Push notifikace ve velkém

PETR DVOŘÁKCEO at Lime

Page 3: Petr Dvořák: Push notifikace ve velkém

Push notifications. The big way.

Page 4: Petr Dvořák: Push notifikace ve velkém

Should be part of every app.

Are not part of every app.

Are simple when done simple.

Mostly, they are pretty hard.

Push notifications

Page 5: Petr Dvořák: Push notifikace ve velkém

Why?

Page 6: Petr Dvořák: Push notifikace ve velkém

Users who opt in to push messages averaged 3x more app launches than those who opted out.

— Localytics

Page 7: Petr Dvořák: Push notifikace ve velkém

65% of users returned to an app in the 30 days after the app’s initial download, if they have push enabled.

— Localytics

Page 8: Petr Dvořák: Push notifikace ve velkém

Forced social login

Privacy concerns

Intrusive ads

Bad UI/UX

Freezing

Complex sign-up

Annoying notifications

0 20 40 60 80

71%

68%

48%

42%

29%

23%

19%

Top 7 reasons why people uninstall mobile apps

Source: Appiterate Survey, as % of all respondent (each respondent picked 3 reasons)

Page 9: Petr Dvořák: Push notifikace ve velkém

Personalized and relevant content.

Delivered in the right time.

Spamming users results in uninstalls.

Test, measure, improve.

Automate engagement.

When it works?

Page 10: Petr Dvořák: Push notifikace ve velkém

Utility & Finance

Taxi & Ride sharing

Travel & Hospitality

Sport

Food & Beverage

Media

Social

Retail & e-commerce

0 10 20 30 40

11%

13%

19%

25%

26%

29%

30%

40%

Push notification engagement by industry

Source: Kahuna

Page 11: Petr Dvořák: Push notifikace ve velkém

In 2015, 49.8% of app users opted in to receiving push notifications. In 2014, it was 52.0%.

— Localytics

Page 12: Petr Dvořák: Push notifikace ve velkém
Page 13: Petr Dvořák: Push notifikace ve velkém

Implementation topics

Page 14: Petr Dvořák: Push notifikace ve velkém

APNs / GCM

Provider

Page 15: Petr Dvořák: Push notifikace ve velkém

1. Register device at APNs and provider.

2. Identify (or segment) users.

3. Send push notifications.

4. Analyze data.

5. Remove unused devices.

What needs to be done?

Page 16: Petr Dvořák: Push notifikace ve velkém

Device registration

Page 17: Petr Dvořák: Push notifikace ve velkém

Registration

APNs

Provider

1. Ask for APNs token.

Page 18: Petr Dvořák: Push notifikace ve velkém

Registration

APNs

Provider

1. Ask for APNs token.

2. Get APNs token

Page 19: Petr Dvořák: Push notifikace ve velkém

Registration

APNs

Provider

1. Ask for APNs token.

2. Get APNs token

3. Send APNs token to provider

Page 20: Petr Dvořák: Push notifikace ve velkém

APNs token

User identifier

Push notification settings

User demographics

User location

… and much more :-)

Data sent to provider

Page 21: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;

UIUserNotificationSettings *set = [UIUserNotificationSettings settingsForTypes:types categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:set]; [[UIApplication sharedApplication] registerForRemoteNotifications]; }

AppDelegate.m

Register for remote notifications

Page 22: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;

UIUserNotificationSettings *set = [UIUserNotificationSettings settingsForTypes:types categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:set]; [[UIApplication sharedApplication] registerForRemoteNotifications]; }

AppDelegate.m

Register for remote notifications

Page 23: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;

UIUserNotificationSettings *set = [UIUserNotificationSettings settingsForTypes:types categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:set]; [[UIApplication sharedApplication] registerForRemoteNotifications]; }

AppDelegate.m

Register for remote notifications

Page 24: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

UIUserNotificationType types = UIUserNotificationTypeBadge | UIUserNotificationTypeSound | UIUserNotificationTypeAlert;

UIUserNotificationSettings *set = [UIUserNotificationSettings settingsForTypes:types categories:nil];

[[UIApplication sharedApplication] registerUserNotificationSettings:set]; [[UIApplication sharedApplication] registerForRemoteNotifications]; }

AppDelegate.m

Register for remote notifications

Page 25: Petr Dvořák: Push notifikace ve velkém

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken { self.registered = YES; [self sendProviderDeviceToken:devToken]; // custom method } - (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err { NSLog(@"Error in registration. Error: %@", err); }

AppDelegate.m

Register for remote notifications

Page 26: Petr Dvořák: Push notifikace ve velkém

- (void)application:(UIApplication *)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)devToken { self.registered = YES; [self sendProviderDeviceToken:devToken]; // custom method } - (void)application:(UIApplication *)app didFailToRegisterForRemoteNotificationsWithError:(NSError *)err { NSLog(@"Error in registration. Error: %@", err); }

AppDelegate.m

Register for remote notifications

Page 27: Petr Dvořák: Push notifikace ve velkém

Sending notifications

Page 28: Petr Dvořák: Push notifikace ve velkém

Send push notifications

APNs

Provider

1. Decide to send push

Page 29: Petr Dvořák: Push notifikace ve velkém

Send push notifications

APNs

Provider

1. Decide to send push

2. Send payload and APNs token

Page 30: Petr Dvořák: Push notifikace ve velkém

Send push notifications

APNs

Provider

1. Decide to send push

2. Send payload and APNs token

3. Deliver the push message

Page 31: Petr Dvořák: Push notifikace ve velkém

Push notification payload

{ "aps" : { "alert" : { "title" : "Hello there!", "body" : "It has been a while." } } }

Maximum payload length is 4096 bytes.

Page 32: Petr Dvořák: Push notifikace ve velkém

Ehm… security?

Page 33: Petr Dvořák: Push notifikace ve velkém

Ehm… security?Push Certifikát (*.pem, *.p12)

Page 34: Petr Dvořák: Push notifikace ve velkém
Page 35: Petr Dvořák: Push notifikace ve velkém
Page 36: Petr Dvořák: Push notifikace ve velkém
Page 37: Petr Dvořák: Push notifikace ve velkém

$ openssl pkcs12 -in apns-dev-cert.p12 -out apns-dev-cert.pem -nodes -clcerts

Page 38: Petr Dvořák: Push notifikace ve velkém

Ehm… security?Push Certifikát (*.pem, *.p12)

Page 39: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$devices = new DeviceCollection(array( new Device('???????') ));

$message = new Message('Hello guys!');

$push = new Push($apnsAdapter, $devices, $message); $pushManager->add($push); $pushManager->push();

Send push notifications

Page 40: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$devices = new DeviceCollection(array( new Device('???????') ));

$message = new Message('Hello guys!');

$push = new Push($apnsAdapter, $devices, $message); $pushManager->add($push); $pushManager->push();

Send push notifications

Page 41: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$devices = new DeviceCollection(array( new Device('???????') ));

$message = new Message('Hello guys!');

$push = new Push($apnsAdapter, $devices, $message); $pushManager->add($push); $pushManager->push();

Send push notifications

Page 42: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$devices = new DeviceCollection(array( new Device('???????') ));

$message = new Message('Hello guys!');

$push = new Push($apnsAdapter, $devices, $message); $pushManager->add($push); $pushManager->push();

Send push notifications

Page 43: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$devices = new DeviceCollection(array( new Device('???????') ));

$message = new Message('Hello guys!');

$push = new Push($apnsAdapter, $devices, $message); $pushManager->add($push); $pushManager->push();

Send push notifications

Page 44: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$devices = new DeviceCollection(array( new Device('???????') ));

$message = new Message('Hello guys!');

$push = new Push($apnsAdapter, $devices, $message); $pushManager->add($push); $pushManager->push();

Send push notifications

Page 45: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

UILocalNotification *localNotif = launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; NSDictionary *userInfo = localNotif.userInfo;

}

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

}

Handle push notifications

Page 46: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

UILocalNotification *localNotif = launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; NSDictionary *userInfo = localNotif.userInfo;

}

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

}

Handle push notifications

Page 47: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

UILocalNotification *localNotif = launchOptions objectForKey:UIApplicationLaunchOptionsLocalNotificationKey]; NSDictionary *userInfo = localNotif.userInfo;

}

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

}

Handle push notifications

Page 48: Petr Dvořák: Push notifikace ve velkém

Feedback service

Page 49: Petr Dvořák: Push notifikace ve velkém

Feedback service

APNs

Provider

1. Request expired tokens

Page 50: Petr Dvořák: Push notifikace ve velkém

Feedback service

APNs

Provider

1. Request expired tokens

2. Expired token list

Page 51: Petr Dvořák: Push notifikace ve velkém

Feedback service

APNs

Provider

1. Request expired tokens

2. Expired token list

3. Delete tokens

Page 52: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$feedback = $pushManager->getFeedback($apnsAdapter); // $feedback contains collection of [device_token, timestamp] pairs

Clean up device tokens

Page 53: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$feedback = $pushManager->getFeedback($apnsAdapter); // $feedback contains collection of [device_token, timestamp] pairs

Clean up device tokens

Page 54: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$feedback = $pushManager->getFeedback($apnsAdapter); // $feedback contains collection of [device_token, timestamp] pairs

Clean up device tokens

Page 55: Petr Dvořák: Push notifikace ve velkém

$pushManager = new PushManager(PushManager::ENVIRONMENT_DEV);

$apnsAdapter = new ApnsAdapter(array( 'certificate' => '/path/to/your/apns-certificate.pem', ));

$feedback = $pushManager->getFeedback($apnsAdapter); // $feedback contains collection of [device_token, timestamp] pairs

Clean up device tokens

Page 56: Petr Dvořák: Push notifikace ve velkém

Silent push notifcation

Interactive actions

Localization

Badge number

Custom sound

Extras

Page 57: Petr Dvořák: Push notifikace ve velkém

Scaling big

Page 58: Petr Dvořák: Push notifikace ve velkém

User management - fast segmentation… by what?

Delivery time - 100k devices x 4096 … 1M devices?

Multiple apps - Reusing the push server

Hardware and infrastructure

Engineering - project grows big, multiple platforms

Dimensions of scaling

Page 59: Petr Dvořák: Push notifikace ve velkém

APNS / GCM

Provider

Page 60: Petr Dvořák: Push notifikace ve velkém

APNs

Provider (business logic)

GCM

SDK SDKApp Management Service Device Registration Service User Segmentation Service

Analytics Data Service

APNS Node GCM Node

Page 61: Petr Dvořák: Push notifikace ve velkém

APNs

Provider (business logic)

App Management Service Device Registration Service User Segmentation Service

Analytics Data Service

GCM

APNS Node GCM Node

SDK SDK

Page 62: Petr Dvořák: Push notifikace ve velkém

APNs

Provider (business logic)

GCM

SDK SDK

APP KEY

App Management Service Device Registration Service User Segmentation Service

Analytics Data Service

APNS Node GCM Node

APP KEYAPP KEY

Page 63: Petr Dvořák: Push notifikace ve velkém

1. Create campaign object

2. Select the audience

3. Send notifications

4. Collect analytics

Campaign planning

Page 64: Petr Dvořák: Push notifikace ve velkém

APNs

Provider (business logic)

GCM

SDK SDKApp Management Service Device Registration Service User Segmentation Service

Analytics Data Service

APNS Node GCM Node

Page 65: Petr Dvořák: Push notifikace ve velkém

APNs

Provider (business logic)

GCM

SDK SDKApp Management Service Device Registration Service User Segmentation Service

Analytics Data Service

APNS Node GCM Node

Page 66: Petr Dvořák: Push notifikace ve velkém

APNs

Provider (business logic)

GCM

SDK SDKApp Management Service Device Registration Service User Segmentation Service

Analytics Data Service

MongoDBMongoDBMongoDB

APNS Node GCM Node

N instances

Partitioning

Page 67: Petr Dvořák: Push notifikace ve velkém

APNs GCM

SDK SDKAPI, admin, workers

Page 68: Petr Dvořák: Push notifikace ve velkém

IBM Bluemix - price, HW scaling, connectivity, …

MongoDB - performance, queries, … (Compose)

Node.js - for “nodes”, speed, efficiency, …

RESTful API - standards, easy to work with, … (PHP, Nette)

Server Technologies

Page 69: Petr Dvořák: Push notifikace ve velkém

Device registration

Push notification processing

UI Features

User profile synchronization

Location monitoring

Analytics

Mobile SDK

Page 70: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { LimeEngate *lime = [LimeEngage sharedInstance];

[lime startFetchingContextForApplicationKey:@“app_8cb31c49a46df1fea11"];

[lime handleRemoteNotificationInfo:[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]]; return YES; }

Set up SDK

Page 71: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { LimeEngate *lime = [LimeEngage sharedInstance];

[lime startFetchingContextForApplicationKey:@"app_8cb31c49a46df1fea11"];

[lime handleRemoteNotificationInfo:[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]]; return YES; }

Set up SDK

Page 72: Petr Dvořák: Push notifikace ve velkém

- (BOOL)application:(UIApplication *)app didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { LimeEngate *lime = [LimeEngage sharedInstance];

[lime startFetchingContextForApplicationKey:@"app_8cb31c49a46df1fea11"];

[lime handleRemoteNotificationInfo:[launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]]; return YES; }

Handle notifications

Page 73: Petr Dvořák: Push notifikace ve velkém

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

LimeEngage *lime = [LimeEngage sharedInstance]; [lime handleRemoteNotificationInfo:userInfo];

}

Handle notifications

Page 74: Petr Dvořák: Push notifikace ve velkém

- (void) application:(UIApplication *)application didReceiveRemoteNotification:(NSDictionary *)userInfo {

LimeEngage *lime = [LimeEngage sharedInstance]; [lime handleRemoteNotificationInfo:userInfo];

}

Handle notifications

Page 75: Petr Dvořák: Push notifikace ve velkém

LimeEngage *lime = [LimeEngage sharedInstance];

lime.currentUser.internalId = @"4378924"; lime.currentUser.name = @"Jan"; lime.currentUser.surname = @"Novak"; lime.currentUser.sex = @"male";

[lime synchronizeCurrentUser];

Update user info

Page 76: Petr Dvořák: Push notifikace ve velkém

LimeEngage *lime = [LimeEngage sharedInstance];

lime.currentUser.internalId = @"4378924"; lime.currentUser.name = @"Jan"; lime.currentUser.surname = @"Novak"; lime.currentUser.sex = @"male";

[lime synchronizeCurrentUser];

Update user info

Page 77: Petr Dvořák: Push notifikace ve velkém

Demo

Page 78: Petr Dvořák: Push notifikace ve velkém

Open-source04/2016

Page 79: Petr Dvořák: Push notifikace ve velkém

Thank you! :)

@joshis_tweets http://getlime.io/

Page 80: Petr Dvořák: Push notifikace ve velkém

WWW.MDEVTALK.CZ

mdevtalk


Recommended