firebase-cloud-messaging

How to use the FCM HTTP v1 API with php

寵の児 提交于 2020-06-25 21:20:21
问题 I have used FCM with the legacy protocol but cannot find any concrete documentation to use the new FCM HTTP v1 API with php. I have managed to import the Google API Client Library into my project but cannot find any documentation or tutorials on how to obtain the access token for the required scopes for fcm messages. 回答1: If you are willing to use an existing library instead of implementing it yourself, you might consider having a look at https://github.com/kreait/firebase-php/ which has

How to use the FCM HTTP v1 API with php

落花浮王杯 提交于 2020-06-25 21:16:53
问题 I have used FCM with the legacy protocol but cannot find any concrete documentation to use the new FCM HTTP v1 API with php. I have managed to import the Google API Client Library into my project but cannot find any documentation or tutorials on how to obtain the access token for the required scopes for fcm messages. 回答1: If you are willing to use an existing library instead of implementing it yourself, you might consider having a look at https://github.com/kreait/firebase-php/ which has

Android notifications: onMessageReceived not called

我的梦境 提交于 2020-06-25 21:15:58
问题 First of all, it's not because the app is in the background. The notifications are sent with a data message payload. In the Play console it says the messages are 'Acknowledged', so they're reaching the device. For most users, the onMessageReceived method is called, but for a minority, it isn't. Why would this be? AndroidManifest: <service android:name=".push.MyFirebaseInstanceIDService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service

Android notifications: onMessageReceived not called

随声附和 提交于 2020-06-25 21:15:49
问题 First of all, it's not because the app is in the background. The notifications are sent with a data message payload. In the Play console it says the messages are 'Acknowledged', so they're reaching the device. For most users, the onMessageReceived method is called, but for a minority, it isn't. Why would this be? AndroidManifest: <service android:name=".push.MyFirebaseInstanceIDService"> <intent-filter> <action android:name="com.google.firebase.INSTANCE_ID_EVENT" /> </intent-filter> </service

Firebase Cloud Function Messaging with APNS Token rather than FCM Token

会有一股神秘感。 提交于 2020-06-23 11:48:58
问题 I am trying to setup a Firebase Cloud Function that will trigger a Cloud Messaging with Payload. The received load by the function however contains Apple APNS Tokens rather than FCM Tokens and I don't see any methods in Firebase Admin SDK allowing APNS Token rather than FCM. Does that mean that I have to write my own APNS Provider and not use FCM?! 回答1: Does that mean that I have to write my own APNS Provider and not use FCM?! You could do that. I don't see how this is a shock. In order to

Firebase Cloud Function Messaging with APNS Token rather than FCM Token

泪湿孤枕 提交于 2020-06-23 11:48:27
问题 I am trying to setup a Firebase Cloud Function that will trigger a Cloud Messaging with Payload. The received load by the function however contains Apple APNS Tokens rather than FCM Tokens and I don't see any methods in Firebase Admin SDK allowing APNS Token rather than FCM. Does that mean that I have to write my own APNS Provider and not use FCM?! 回答1: Does that mean that I have to write my own APNS Provider and not use FCM?! You could do that. I don't see how this is a shock. In order to

Firebase Cloud Functions Tokens

那年仲夏 提交于 2020-06-17 15:34:50
问题 I need help. Cloud functions written in node.js are throwing errors and not causing push notifications (alerter) to alert in my Android java app that a comment has been made or that a user has liked a post. On Firebase Console, I was able to get the error message in cloud functions log: Successfully sent message: { results: [ { error: [Object] } ], canonicalRegistrationTokenCount: 0, failureCount: 1, successCount: 0, multicastId: 7952971403531609000 } When I view the error message on Firebase

getApplication () in FirebaseMessagingService

安稳与你 提交于 2020-06-17 13:01:52
问题 Apparently FirebaseInstanceIdService is depricated. So, I'm trying to changed this code: import androidx.annotation.Nullable; import com.google.firebase.iid.FirebaseInstanceId; import com.google.firebase.iid.FirebaseInstanceIdService; public class InstanceIDService extends FirebaseInstanceIdService { @Override public void onTokenRefresh() { // Get updated InstanceID token. String refreshedToken = FirebaseInstanceId.getInstance().getToken(); sendRegistrationToServer(refreshedToken); } private

Bad Request [400], FCM Legacy HTTP API with Retrofit

放肆的年华 提交于 2020-06-17 09:42:09
问题 URL = https://fcm.googleapis.com/fcm/send Request Body { "registration_ids": ["token 1","token 2"], "priority": "high", "notification": { "title": "Divine Public School", "body": "Test Message." } } Header { "Content-Type: application/json", "Authorization: key=<myServerKey>" } I am getting status code 200 and even receiving notification in client app when hitting this url from Postman. But when I am trying to do the same in android using retrofit , I am getting status 400 Bad Request.

What's the difference between instanceId and getIdToken

耗尽温柔 提交于 2020-06-17 04:46:49
问题 I don't understand what's the difference between: FirebaseAuth.getInstance().currentUser.getIdToken(true).addOnSuccessListener { Log.d("tag",it.token) // token #1 } FirebaseInstanceId.getInstance().instanceId.addOnSuccessListener { Log.d("tag", it.token) //token #2 } Both of these methods return some token, what is the difference between them? 回答1: getIdToken(boolean forceRefresh) Fetches a Firebase Auth ID Token for the user; useful when authenticating against your own backend. The