Self Implementation

Basic Notification Management

To handle Notifications from the App, create class in App project namedCustomMessangiService:

package com.ogangi.Messangi.SDK.Demo;

import android.util.Log;

import com.google.firebase.messaging.RemoteMessage;
import com.messaging.sdk.MessagingFirebaseService;
import com.messaging.sdk.MessagingNotification;

public class CustomMessangiService extends MessagingFirebaseService {

 ....
   @Override
   public void onNewToken(String s) {
       super.onNewToken(s);
   }

   @Override
   public void onMessageReceived(RemoteMessage remoteMessage) {
       //example to custom
       MessagingNotification messagingNotification = new MessagingNotification(remoteMessage);
       messaging = Messaging.getInstance(this);
       messaging.sendGlobalEventToActivity(Messaging.ACTION_GET_NOTIFICATION,messagingNotification);
   }
}

It is important to overrideonNewTokenmethod to usesuper.onNewToken(s) (heredity) for the proper functionality of the SDK.

For this custom class you can receive messages overwriting the methodonMessageReceived.

Remember if you want to useCustomMessangiService, declare service in the Manifest.xml of the App project:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
   xmlns:tools="http://schemas.android.com/tools"
   package="com.ogangi.Messangi.SDK.Demo">

   <application
       .....
       <activity 
       </activity>
       <service
                   android:name=".CustomMessangiService"
                   android:permission="com.google.android.c2dm.permission.SEND">
                   <intent-filter>
                       <action android:name="com.google.firebase.MESSAGING_EVENT" />
                       <action android:name="com.google.android.c2dm.intent.RECEIVE" />
                   </intent-filter>
       </service>
   </application>
</manifest>
Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.