push notifications (lecture 22 – push notifications)

13
Push Notications Android Поляков Никита

Upload: noveo

Post on 13-Apr-2017

96 views

Category:

Education


4 download

TRANSCRIPT

Page 1: Push Notifications (Lecture 22 – push notifications)

Push Noti�cationsAndroid

Поляков Никита

Page 2: Push Notifications (Lecture 22 – push notifications)

Решение в лоб

Page 3: Push Notifications (Lecture 22 – push notifications)

Минусы

Постоянное соединение с серверомПонадобиться мощный сервер при большом количестве пользователейМного работы на низком уровне системыСложная логика на сервере

Page 4: Push Notifications (Lecture 22 – push notifications)

Google cloud messaging

Page 5: Push Notifications (Lecture 22 – push notifications)

Внутри приложения

https://github.com/googlesamples/google-services/tree/master/android/gcm

1 <uses-permission android:name="com.google...permission.RECEIVE" /> 2 <uses-permission android:name="android.permission.WAKE_LOCK" /> 3 4 <receiver android:name="com.google...GcmReceiver" 5 <!> 6 </receiver> 7 <service 8 android:name="gcm.play...MyGcmListenerService" 9 android:exported="false" > 10 <intent-filter> 11 <action android:name="com.google...intent.RECEIVE" /> 12 </intent-filter> 13 </service> 14 <service15 android:name="gcm.play...MyInstanceIDListenerService" 16 <!> 17 </service> 18 <service19 android:name="gcm.play...RegistrationIntentService" 20 android:exported="false"> 21 </service> 22 </application>

Page 6: Push Notifications (Lecture 22 – push notifications)

Vincent, we happy?

https://habrahabr.ru/company/mailru/blog/260841/

Page 7: Push Notifications (Lecture 22 – push notifications)

Есть спрос — есть предложение

тут должна была быть картинка с кучей сервисов, но мне было лень искать и втыкать иконкив одну картинку так что держите лучше котика

Page 8: Push Notifications (Lecture 22 – push notifications)

Интеграция Localytics 1 <meta-data 2 android:name="LOCALYTICS_APP_KEY" 3 android:value="YOUR-LOCALYTICS-APP-KEY" /> 4 <receiver 5 android:name="com.localytics.android.ReferralReceiver" 6 android:exported="true"> 7 <intent-filter> 8 <action android:name="com.android.vending.INSTALL_REFERRER" /> 9 </intent-filter> 10 </receiver>

И немного джава кода

1 // добавляем в главном активити 2 @Override 3 protected void onNewIntent(Intent intent) { 4 super.onNewIntent(intent); 5 Localytics.onNewIntent(this, intent); 6 } 7 8 // добавляем в Application 9 @Override 10 public void onCreate() { 11 super.onCreate(); 12 Localytics.autoIntegrate(this); 13 }

Page 9: Push Notifications (Lecture 22 – push notifications)

Yes, we happy.

Page 10: Push Notifications (Lecture 22 – push notifications)

Firebase

Page 11: Push Notifications (Lecture 22 – push notifications)

Плюшки FCM

Легче интегрировать

Пермишены мёржатся в манифест сами

Упростили схему получения RegistrationID

Стал более кросплатформенный

Page 12: Push Notifications (Lecture 22 – push notifications)

Больше плюшек

Realtime Database — сервисы для управления облачной NoSQL базой данных.

Authentication — сервис для идентификации и управления пользователями.

Remote Con�g — сервис, который позволяет изменять и обновлять части приложенийчерез без обновления приложения.

Как и многие другие элементы Firebase, Noti�cations интегрируются в Firebase Analytics.

Page 13: Push Notifications (Lecture 22 – push notifications)

Посмотрим, как это работает