We are planning to wirte a messaging/chat kind applicaiton on Android.We are planning to use GCM to exchange messages.The traditional way is to have a Application Server to store all the gcmid of the users and if user1 wants to send message to user2,
1.The user1 send the message to Application server with payload which contains message and receipent id i.e user2 2.The application server retrieves the gcmid of user2 and call sender.send(regid2 , message) 3.User2 receives the message.
I see it is just a REST API Call to https://android.googleapis.com/gcm/send.
So if somhow user1 has the gcmid of user2 why can't we directly call the gcm API from user1 device to reduce the load on server and cost of operations on server.Pls advise me on this.
Note:We are not planning to use Upstreaming
i did the same using Device_To_Device_Messaging_Using_Google_Cloud_Messaging_GCM_-_Android_Example tutorial. this tut is having complate sever as well as client code using gcm. go through it,will help you to achieve what you want.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With