Google Cloud Messaging

Please tell me - Where I should write this code?

import com.google.android.gcm.server.*;

Sender sender = new Sender(myApiKey);
Message message = new Message.Builder(regId).build();
Result result = sender.send(message, 5);

Answers


Have you ever checked the GCM demo application in Developer Android ?Here is the link. You will find a demo application and you check how they did it, then you can see where you are wrong. Hope it helps...


You can use this code even from simple java console application.

public static void main(String[] args){
   Sender sender = new Sender(myApiKey);
   Message message = new Message.Builder(regId).build();
   Result result = sender.send(message, 5);
}

necessary libraries: gcm-server.jar, json_simple-1.1.jar, junit.jar, mockito-all-1.8.5.jar.


Need Your Help

Mac App Store security IAP (or receipt verification) for educational content

osx xcode4 in-app-purchase mac-app-store

For receipt validation of an application that provides educational content to students, do I need to use In-App purchase or it will be fine with only Receipt validation?

VB.Net detecting SHIFT key on datagridview editing control

vb.net datagridview

I have a editing control that Inherits myTextBox this Implements IDataGridViewEditingControl.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.