天道酬勤,学无止境

firebase-cloud-messaging

Set FCM channel ID in PHP for notifications

I'm trying to send FCM notification to Android device using PHP. My code is working for devices before Android O. In Android O, we need to set channel ID in request as well to receive notifications, which I cannot figure out how to do. I have done the necessary setup in the app and using Firebase Console I can receive a notification, but it fails when I try sending it through the PHP script. I also looked into the link below but it doesn't work for me. Android FCM define channel ID and send notification to this channel through PHP My PHP code: $notification = new Notification(); $notification-

2021-09-24 07:21:17    分类:问答    php   android   firebase   firebase-cloud-messaging

When an app is in background, onMessageReceived method is not firing

Actually i need to show badge in app icon but i don't know how to get badge and why onMessageReceived not call when app is in background or app is not running. public class Custom_FirebaseMessagingService extends FirebaseMessagingService { private static final String TAG = "FirebaseMsgService"; String activityName; @Override public void onMessageReceived(RemoteMessage remoteMessage) { if (remoteMessage == null) return; if (remoteMessage.getNotification() != null) { Log.i(TAG, "Notification Body: " + remoteMessage.getNotification().getBody()); } // Check if message contains a data payload. if

2021-09-23 21:06:53    分类:问答    android   firebase   firebase-cloud-messaging   badge

Invalid topic value provided - While sending FCM to a topic

I am trying to send an FCM message to a topic. But getting "Invalid topic value provided" error from the server. Json Payload { "message":{ "topic":"/topics/news", "data":{ "title":"Hellow World", "message":"This is the Topic Message", "type1":"100", "type2":"abc" } } } Response { "error":{ "code":400, "message":"Request contains an invalid argument.", "status":"INVALID_ARGUMENT", "details":[ { "@type":"type.googleapis.com/google.rpc.BadRequest", "fieldViolations":[ { "field":"message.topic", "description":"Invalid topic value provided." } ] }, { "@type":"type.googleapis.com/google.firebase

2021-09-23 16:07:13    分类:问答    android   firebase   push-notification   firebase-cloud-messaging

FCM send msg through firewall using firebase-admin library

In company we have firewall. We've enabled fcm.googleapis.com 433 adress. But it havent helped. Still jboss application can not send push request using com.google.firebase:firebase-admin library. I know about range of IPs but that is not possible for admins to maintain such range of IPs in our company. But we can set it for url names (I was told so). But this one addres havent helped. I've looked into com.google.firebase:firebase-admin com.google.auth:google-auth-library-oauth2-http And found few other addresses: https://accounts.google.com https://iid.googleapis.com Have anyone else opened

2021-09-23 11:25:30    分类:问答    java   firebase   firebase-cloud-messaging   firebase-admin

Can you expire / remove a message remotely on FCM?

I'm using FCM for my push messages. Its great, however I've a client that needs to be able to remove a push message once its sent - (in case of mistakes / typos etc). I know you can get the message id from when the Topic is queued to send messages, just wondering if there is a way to then use that ID to expire those messages remotely. i.e. to delete the message.

2021-09-09 02:54:07    分类:问答    firebase   firebase-cloud-messaging   cordova-plugin-fcm

Push notification received while the app is in the foreground is different from push notification received when the app is in background

I have implemented FCM push notifications in an android app. While I am logged in to the app. I get the notification in the form that I am expecting as below. When the app is in background I receive the json response instead as below. Following is the code I have added in onMessageRecieved() NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this) .setContentTitle("App") .setContentText(messageBody) .setAutoCancel(true) .setSound(defaultSoundUri) .setSmallIcon(R.mipmap.ic_launcher) .setContentIntent(pendingIntent) .setStyle(new NotificationCompat.BigPictureStyle()

2021-09-08 23:57:32    分类:问答    android   firebase   firebase-cloud-messaging   android-notifications

Flutter FCM Navigation onResume/onLaunch

In my app, I got a class "home" where the user is navigated to after he is authorized. Within "home" there is a PageView with BottomNavigationBar. When the user is getting a push notification from firebase (new message) he should be navigated to ChatHome and to the specific chat after tapping. How can I do this? Home does look like this @override Widget build(BuildContext context) { return Scaffold( key: _scaffoldKey, body: PageView( children: <Widget>[ Feed(userID: widget.userID), SearchView(), ChatHome(), Profile( uid: currentUser?.uid, auth: widget.auth, logoutCallback: widget

2021-09-08 21:54:50    分类:问答    flutter   dart   navigation   firebase-cloud-messaging

user to user push notifications

I have seen many questions on here and online that address this topic, but they all are from a long time ago, and are possibly outdated. I wanted to get a more recent answer if Firebase has implemented anything recently that is capable of a user to user push notification system, essentially what is used in all chat applications, or if the best option is still currently using Onesignal.

2021-09-08 08:36:37    分类:问答    ios   firebase   apple-push-notifications   firebase-cloud-messaging   onesignal

Set up "firebase javascript" to use with "ionic serve"

I want to use Firebase Javascript, in an Ionic 2 project so I can develop the Push Notification logic that I want to apply, and test it in a browser, by using the CLI "ionic serve". I've followed the step as explain in the doc under node.js / ES2015: I did a CLI "npm install --save firebase" to add it to my project. And then at the top of one of my project service I did: import [regular Ionic 2 and Angular 2 import stuffs]; import * as firebase from 'firebase'; @Injectable() export class PushNotifService { constructor(private platform:Platform){ console.log("PushNotifService starts"); console

2021-09-08 08:18:08    分类:问答    node.js   cordova   firebase   ionic2   firebase-cloud-messaging

MyFirebaseMessagingService is not working but notification is shown

I receive notifications from Firebase but my classes I've created not working (not involved in the actions). Seems like they are shown by default. public class MyFirebaseMessagingService extends FirebaseMessagingService { @Override public void onMessageReceived(RemoteMessage remoteMessage) { String title = remoteMessage.getNotification().getTitle(); String message = remoteMessage.getNotification().getBody(); String click_action = remoteMessage.getNotification().getClickAction(); Intent intent = new Intent(click_action); intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); PendingIntent

2021-09-08 07:04:02    分类:问答    android   firebase   notifications   onclick   firebase-cloud-messaging