Skip to content
Advertisement

App crashes when receiving notification from firebase PHP API

I want to send a notification to a user via firebase PHP API. I followed a tutorial but the app crashes when the API runs and if the app it’s not open nothing will happen.

this is the code:

JavaScript

I can send notifications via firebase without any problem. NOTE: I’m running PHP code on localhost with Xampp.

here’s my app code:

MainActivity

JavaScript

FirebaseInstanceIdService:

JavaScript

FirebaseMessagingService:

JavaScript

MyNotification:

JavaScript

Error:

JavaScript

Advertisement

Answer

i found the problem:

JavaScript

firebase API doesn’t support remoteMessage so if you remove it and set title and body manually problem will be solved.

I don’t know how to get the title and body from API.

User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement