Controlling Android push notifications with Pinpoint

0

I've set up an Android app to receive push notifications using Amplify and Pinpoint. I followed the directions step by step.

I do receive notifications, but there are a couple of problems.

One, the icon associated with the notification is a generic Android icon instead of my app's icon.

Two, and more importantly, the notifications do not appear if my app is open when the notification is sent. I've implemented Android notifications in the past without using an external framework, and I know that what I need to be doing is overriding the onMessageReceived method of FirebaseMessagingService. However in this case, I'm using a subclass of FirebaseMessagingService provided by Amplify, which is called FCMPushNotificationService. I thought I could just extend FCMPushNotificationService and override onMessageReceived, but I cannot, because FCMPushNotificationService is a final class.

So what I need is either (a) some other way to get a callback when a notification arrives, or (b) a way to configure FCMPushNotificationService in such a way that it displays notifications even when the app is open.

Ideas?

Frank
feita há um ano415 visualizações
1 Resposta
0

I had to write a lot of code, but I was able to intercept the notification in the case where my app is open and re-post it as a new notification. So the main problem is resolved.

I'm still flummoxed by the other problem though. I can fill in the "Android Image" field in Pinpoint and that does add an image to my message, but it doesn't change the icon, just adds it as an additional image.

Frank
respondido há um ano

Você não está conectado. Fazer login para postar uma resposta.

Uma boa resposta responde claramente à pergunta, dá feedback construtivo e incentiva o crescimento profissional de quem perguntou.

Diretrizes para responder a perguntas