firebase-notifications

Firebase console: How to specify click_action for notifications

老子叫甜甜 提交于 2019-11-27 06:46:15
I implemented Firebase and testing the Firebase notifications. When the app is in the foreground I don't have problems, I implemented a service that extends FirebaseMessagingService and handle the message and data in onMessageReceived I have problems when the app is in background, I would like to send a notification that opens a specific activity and does what I schedule to do, not just opening the App. I did as described on the Firebase guide, but I'm not able to start the specific activity. Here the manifest: <activity android:name=".BasicNotificationActivity"> <intent-filter> <action

Firebase Cloud Messaging Auth Tokens vs Registration Token

狂风中的少年 提交于 2019-11-27 02:54:15
问题 Is there a difference between the firebase.auth().getToken() and the FCM registration token returned via Android setup: FirebaseInstanceId.getInstance().getToken() ? I am currently using https://www.npmjs.com/package/firebase which uses the first method above to setup auth as well as generate a token. Using that token when trying to send a notification returns: error:InvalidRegistration... 回答1: The Auth and FCM tokens are different and unrelated. The Firebase Authentication ID token

Clicking on notification doesn't open mentioned activity

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 02:32:50
问题 I am trying to open an Activity when the notification is clicked and below is my code. Intent intent = new Intent(this.getApplicationContext(), NotificationActivity.class); intent.putExtra("msgBody",messageBody); intent.putExtra(Constants.NOTIF_INTENT_TYPE,Constants.NOTIF_INTENT_TYPE); intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK |Intent.FLAG_ACTIVITY_SINGLE_TOP |Intent.FLAG_ACTIVITY_CLEAR_TOP); //Tried with many options here PendingIntent pendingIntent = PendingIntent.getActivity(this, 0 ,

How to use an existing GCM token within another Firebase project?

非 Y 不嫁゛ 提交于 2019-11-27 02:03:34
问题 Lets say I have Google Cloud Project (GCP1) with GCM turned on with Client id P1. Now I have created a standalone Firebase project F2 WITHOUT importing it to GCP1. I have also released F2 to production. (Alternatively, I have imported F2 from an existing firebase.com project into the new Firebase console). I use a backend server to send push notifications. When I send a push to a GCM token generated via GCP1 from the F2 project, it fails (naturally) because of incorrect client ID. Are there

Open specific Activity when notification clicked in FCM

守給你的承諾、 提交于 2019-11-27 01:08:38
I am working on App in which I am required to show notification. For notification, i am using FireBase Cloud Messaging (FCM) . I am able to get Notification when app is in background. But when I click on notification, it redirect to home.java page. I want it to redirect to Notification.java page. So,please tell me how to specify Activity in on Click of notification. I am using two services: 1.) MyFirebaseMessagingService 2.) MyFirebaseInstanceIDService This is my code sample for onMessageReceived() method in MyFirebaseMessagingService class. public class MyFirebaseMessagingService extends

How To Create Topic in FCM Notifications

旧时模样 提交于 2019-11-26 23:39:51
I'm trying Firebase-Notification API the service is worked perfect when i send downstream message from console to app, but how to send message to topic registered users ? i did in android side FirebaseMessaging.getInstance().subscribeToTopic("TopicName"); but when i try send downstream message from console to topic it's says This project does not have any topics EDIT : i figured out that after mapping the topic it's take up to 1 day to show up in Firebase Console This is an alternate path. If you subscribe a client app to an unexisting topic then the topic will also be created without having

Firebase push notifications update DB

牧云@^-^@ 提交于 2019-11-26 22:30:56
I'm trying to send some data to my users via the new Firebase push notifications service. I'm adding some "key-value" custom data items with 'Message text' - "dbupdate" to detect if it's an update message or a normal push notification that I want to show my users. In my receiver I check i there is custom data and run the update, if true. If this isn't the case, I show a normal notification with the text message. It works only when my application opened. If the application is closed, the notification is shown anyway, and my if check doesn't even running, some code: public class

Firebase onTokenRefresh() is not called

无人久伴 提交于 2019-11-26 22:17:44
In my MainActivity in my log, I can see the token using FirebaseInstanceId.getInstance().getToken() and it display the generated token. But it seems like in my MyFirebaseInstanceIDService where it is extends to FirebaseInstanceIdService , the onTokenRefresh() is not called, where in this function it was said that the token is initially generated here. I needed to call sendRegistrationToServer() that's why I'm trying to know why it doesn't go in the onTokenRefresh() . Here is my code public class MyFirebaseInstanceIDService extends FirebaseInstanceIdService { @Override public void

Count subscribers of a topic in Firebase Cloud Messaging

我怕爱的太早我们不能终老 提交于 2019-11-26 22:04:53
问题 What I want to do with my app is this: users can select different interests and as soon as there are more than ~5 people interested in the same thing, I want to send them a notification. I thought Firebase + Topics would be a good choice for this. But how do I find out how many people have subscribed to a topic? 回答1: There is no available API to check how many subscribers a topic has. (see my answer here) You'll have to implement the mapping on your server-side, saving the name of the topics

How do you send a Firebase Notification to all devices via CURL?

耗尽温柔 提交于 2019-11-26 21:37:50
I'm attempting to send out a notification to all app users (on Android), essentially duplicating what happens when a notification is sent via the Firebase admin console. Here is the CURL command I begin with: curl --insecure --header "Authorization: key=AIzaSyBidmyauthkeyisfineL-6NcJxj-1JUvEM" --header "Content-Type:application/json" -d "{\"notification\":{\"title\":\"note-Title\",\"body\":\"note-Body\"}}" https://fcm.googleapis.com/fcm/send Here's that JSON parsed out to be easier on your eyes: { "notification":{ "title":"note-Title", "body":"note-Body" } } The response that comes back is