3

for the server-sided implementation to support upstream and downstream messages via XMMP, I use org.jivesoftware.smack.tcp.XMPPTCPConnection. I migrated from GCM to FCM and now my app server does not receive any upstream messages anymore. Do I have to change host, port or something else to use FCM?

From Android client I send messages like:

String senderId = ctxt.getResources().getString(com.app.teamchannel.R.string.sender_id);

        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());

        Log.v(Constants.TAG, "verification message successfully sent: " + GcmConstants.ACTION_CHAT + " -> " + Constants.FLAG_NEW_CHAT);
Johannes N
  • 265
  • 3
  • 17
  • Is your app server connecting to CCS with the same sender ID as the one you are using to send the upstream message? Moving from GCM to FCM should not have any effect on your apps ability to send and receive upstream messages. – Arthur Thompson Jul 29 '16 at 01:01
  • You're right. And it was my mistake. I put my google-services.json in the wrong folder. Now the communication between the endpoints from google cloud server and my app server works. – Johannes N Jul 29 '16 at 06:18

1 Answers1

0

Solved the problem. I put my google-services.json in the wrong folder. Now the communication between the endpoints from google cloud server and my app server works.

Johannes N
  • 265
  • 3
  • 17