으로 마이그레이션 한 후 FCM 콜백 핸들러가 실행되지 않습니다. here과 같이 GCM에서 FCM으로 이전했습니다.gcm에서 fcm
메시지를 보낼 때마다 onMessageSent 메서드가 호출되지 않습니다. 왜 작동하지 않는
Map<String,String> data = new HashMap<String,String>();
data.put(GcmConstants.ACTION, GcmConstants.ACTION_CHAT);
data.put(Constants.CHAT_FLAG, Constants.FLAG_NEW_CHAT);
ObjectMapper mapper = new ObjectMapper();
String chatJsonInString = mapper.writeValueAsString(Helper.chatToJson(chat));
data.put(Constants.CHAT_JSON, chatJsonInString);
String receiverJsonInString = mapper.writeValueAsString(Helper.userToJson(receiver));
data.put(Constants.RECEIVER_JSON, receiverJsonInString);
String id = Integer.toString(getNextMsgId(ctxt));
FirebaseMessaging fm = FirebaseMessaging.getInstance();
fm.send(new RemoteMessage.Builder(senderId + "@gcm.googleapis.com").setMessageId(id).setData(data).build());
:
나는 메시지를 보낼 소스 코드를 다음 사용합니까? onMessageReceived의 시작
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
// [START_EXCLUDE]
// There are two types of messages data messages and notification messages. Data messages are handled
// here in onMessageReceived whether the app is in the foreground or background. Data messages are the type
// traditionally used with GCM. Notification messages are only received here in onMessageReceived when the app
// is in the foreground. When the app is in the background an automatically generated notification is displayed.
// When the user taps on the notification they are returned to the app. Messages containing both notification
// and data payloads are treated as notification messages. The Firebase console always sends notification
// messages. For more see: https://firebase.google.com/docs/cloud-messaging/concept-options
// [END_EXCLUDE]
// TODO(developer): Handle FCM messages here.
: 당신은 공식 웹 사이트의 예를 here 보면
어디에서 보내고 있습니까? –