We were using GoogleCloudMessaging.getInstance(context).send(context.getString(R.string.gcm_defaultSenderId) + "@gcm.googleapis.com", mId, mBundle);
to send upstream messages, but since I was trying to migrate new fcm
concept, I need to change that too, but could not find any documentation yet.
My best guess is to use :
RemoteMessage message = new RemoteMessage.Builder(<?>).setMessageId(mId).setData ...
FirebaseMessaging.getInstance().send(message);
but then what is it the Builder takes as a parameter? Yet again, could not find api...
So simply as title states, how to send upstream messages using new fcm
concept?
Well you can send your message directly to android devices from android application, here is the simple implementation I have done and it works great for me.
compile android volley library
Just copy paste this simple function ;) and your life will become smooth just like knife in butter. :D
Note If you want to send message to topics so you can change parameter instanceIdToken to something like /topics/topicName. For groups implementation is the same but you just need to take care of parameters. checkout Firebase documentation and you can pass those parameters. let me know if you face any issue.
Well, my answer comes fast. Keeping question and answer for future reference. I have found the answer on https://firebase.google.com/docs/cloud-messaging/android/upstream#sample-send
thanks to google's smart exclusion to search results
In order to show you the most relevant results, we have omitted some entries very similar to the 2 already displayed. If you like, you can repeat the search with the omitted results included.
new API would be like: