Hi, i have notification in my android app. i setup it successfully and get notification as i want. but i want to manage our notification and save it in local database so i want to get body of notification in a service. i get this line after any receive of notification:
I/BackendlessFCMService: Notification has been received by default ‘BackendlessFCMService’ class. You may override this method in a custom fcm service class which extends from ‘com.backendless.push.BackendlessFCMService’. The notification payload can be found within intent extras: msgIntent.getStringExtra(PublishOptions.<CONSTANT_VALUE>).
… So, i created a class and extends from BackendlessFCMService and overrides onMessage method and add my service in manifest, but i can’t get in my code in custom service, help me just show a toast, rest of it is with us, haaah… thank you for your help.
manifest:
…
<service android:name=".ui.notification.NotificationService">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
…
NotificationService:
…
import android.content.Context;
import android.content.Intent;
import android.widget.Toast;
import com.backendless.push.BackendlessFCMService;
public class NotificationService extends BackendlessFCMService {
@Override
public void onCreate() {
super.onCreate();
android.os.Debug.waitForDebugger();
}
@Override
public boolean onMessage(Context appContext, Intent msgIntent) {
Toast.makeText(appContext, "Hey You!", Toast.LENGTH_LONG).show();
return super.onMessage(appContext, msgIntent);
}
public NotificationService() {
super();
}
}
…