简体   繁体   中英

Send Push notification from android

I want to show push notification in my Android app. I have read online about this Firebase Cloud Messaging (Formerly known as GCM) but can't understand it properly. In every tutorial they are using some sort of console on webpage to send notifications to all users or a particular user. What i want is to send notification automatically when a message is sent to some user(A send message to B and B gets a Notification) not from some console.

Any help?

Push notifications can't go from user to user, ie from User A to User B.

The message must go from User A , to your server , and then from your server , to User B

If your messages are not too frequent (like emails, for example), you can build a Service that will poll messages from the server regularly and display a notification using the NotificationManager .

Otherwise you should stick to Firebase and create a server-side code to interact with the firebase API to notify your users... Firebase API for servers are explained here .

Sticking with firebase is IMHO the better option...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM