I was able to obtain the Registration key on my client app using the code
GCMRegistrar.register(this, "805421596082");
I received the Registration id.
I AM USING THE FOLLOWING JAVA CODE TO POST MESSAGE.
import java.util.ArrayList;
import com.google.android.gcm.server.Message;
import com.google.android.gcm.server.MulticastResult;
import com.google.android.gcm.server.Result;
import com.google.android.gcm.server.Sender;
public class Notify {
public static void main(String args[]) {
try {
Sender sender = new Sender("AIzaSyAj0cooI3YxBzbug-6CcmJQdRXxGKphRbU"); // This is the server api key
Message message = new Message.Builder()
.collapseKey("1")
.timeToLive(3)
.delayWhileIdle(true)
.addData("message",
"this text will be seen in notification bar!!")
.build();
Result result = sender
.send(message,
"APA91bEMi5lmYKxaJX4-80eUp1JsW50_jSbZoqUs16xswI9EuXK_Km3qyuGxvoqKBvg9_5009naFrF7VKBknOKEo946SWtH57cd_m5BbTxpgaaT_Iy-m9McyV6aqy6BjxAy0d57arqp2yq6mHZrgw7qx-o4ntv7T2Q", // This is the registration id
1);
} catch (Exception e) {
e.printStackTrace();
}
}
}
WHEN I LOG THE RESULT VALUE I AM GETTING "[ errorCode=MismatchSenderId ]"
I am not able to proceed further. It would be great help if somebody could suggest me a solution for this.