简体   繁体   中英

Android : GCM Push Notification to particular device

I am creating an Android app where in I require to send the push notifications to a particular device like whatsapp sending as the notfication when a new message comes.

I can send notifications to multiple Devices very perfectly..There is no issue at all..

Here the query is How can I send Notification to particular device (or user).

What should be done to send the push notification to the particular individual user in Android?

Can any give me an idea

Thanks in Advance

First register the device to GCM and get the gcm key. Send the notification to that device manually using the GCM key. Curl request to do so is

curl --header "Authorization: key=" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -XPOST -d '{"data":{"New message through curl"},"registration_ids":["<RegId1>"]}'

To send it using PHP go through following

GCM with PHP (Google Cloud Messaging)

I think you have to make a matching like user->reg id and store it in some storage on the third party server. After that you can pick a user and his reg id to send it to.

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