Rahul Parate
Rahul Parate

Reputation: 219

Android (c2dm) push notification error

i am creating a push notification server for android by using C2DM-Sharp library. i have created a sample code to test push notification, but while iam closing the connection the code is giving an error "One or more errors occurred." "A task was canceled." below is my code

C2dmService service;

        //Service emailid 
        var senderID = "[email protected]"; 
        var password = "myservice Password";
        //The application that is registering to receive messages
        var applicationID = "appID";

        service = new C2dmService(senderID, password, applicationID);

        service.Start();
        NameValueCollection extras;
        //for (int i = 0; i < 3; i++)
        //{
            extras = new NameValueCollection();
            //
            string registrationId = textBox4.Text;
            //An ID issued by the C2DM servers to the Android application that allows it to receive messages
            string collapseKey = "CKEY";
            string key = "count";
            string value = "5";
            extras.Add(key, value);

           //Queue up the message to be sent
            service.QueueMessage(registrationId, extras, collapseKey);
        //}
            service.Stop();------- its giving error here at the time of stoping the service

Upvotes: 1

Views: 935

Answers (1)

DynamicMind
DynamicMind

Reputation: 4258

I have already given the answer of all think relate to C2DM service in android please show the given link

C2DM permission.C2D_MESSAGE gives Installation error

c2dm : how to receive the message in the device? (using PHP)

Upvotes: 1

Related Questions