How to setup push notifications in Applozic?

Updated 6 months ago by Devashish Datt Mamgain

Applozic supports push notifications for incoming messages on both Android and iOS devices. To setup follow the steps below: 

Android: 

i)  The first step is to add firebase to your project. You can find the steps here.

ii)  Next you need to setup FCM in you app, and generate the device token. You can do it here.

iii) Device token generated in Step (ii) needs to be stored in Applozic preferences. To enable add the following code in your  onTokenRefresh() method of FcmInstanceIDListenerService (The one with action INSTANCE_ID_EVENT)

Applozic.getInstance(this).setDeviceRegistrationId(FirebaseInstanceId.getInstance().getToken
          ()); 
          if (MobiComUserPreference.getInstance(this).isRegistered()) {
              new RegisterUserClientService(this).updatePushNotificationId(registrationToken);
          }

iv)  To receive Applozic push notifications, add the below code in your
onMessageReceived(RemoteMessage remoteMessage) method of FcmListenerService (The one with action MESSAGING_EVENT)

 if (remoteMessage.getData().size() > 0) {
           if (MobiComPushReceiver.isMobiComPushNotification(remoteMessage.getData())) {
               Log.i(TAG, "Applozic notification processing...");
               MobiComPushReceiver.processMessageAsync(this, remoteMessage.getData());
               return;
           }
       }

v) Add Applozic push notification services in your AndroidManifest.xml

vi)  Once you are done with above setup, register device token to Applozic server on successful login. To achieve this make sure PushNotificationTask is called in success of Applozic login. Detailed doc on this can be found here.

vii) After the initial setup , you need to Sign In to Applozic Dashboard with your credentials (If you don’t have an account Create One Here)

viii) Next click on Action → Edit Application → Push Notification

ix) Finally update your key in the form field next to GCM/FCM Server Key, under Android


iOS:

i) Sign In to Applozic Dashboard with your credentials (If you don’t have an account Create One Here)

ii) Click on Action → Edit Application → Push Notification

iii) Upload Development Certificate and enter the corresponding certificate password.

iv) Upload Distribution Certificate and enter the corresponding certificate password. 

Distribution certificate is different from Development Certificate, and has to be mandatorily uploaded before you release your app on iTunes 



How Did We Do?