I am playing around with the Google Cloud Messaging sample code given in Android SDK. Both the client and server code works fine. I have installed the GCM client android app in three android devices and when the server is running each of the devices gets registered successfully to the GCM Server. And whenever I try to send message the server broadcasts the messages to all the three devices. But my question is whether we can blacklist any of the device or allow the server to send message to any of the particular device.
Is there any method to restrict the device using the registrationID generated in the server for each devices?
Here is the server code for sending push notification
if (devices.size() == 1) {
String registrationId = devices.get(0);
if(!(registrationId .equalsIgnoreCase("APA91bE61KYmI4Qzn9NKkh6wkHr1ya8FIfGbc_gYJf0_33558IeFnj9j8j4EPRaJeSKJ_CK6_a9FQLt_CapLE4e_mvRaq3hytJalfjTBbkAxbLIdfdXyoxatSrDPmtxSdyaeiRV-Bav-4qOSlURH5mL69Fa9ktX8JFoow")))
{
Message message = new Message.Builder().build();
Result result = sender.send(message, registrationId, 5);
results = Arrays.asList(result);
}
} else {
// send a multicast message using JSON
Message message = new Message.Builder().build();
MulticastResult result = sender.send(message, devices, 5);
results = result.getResults();
}