1
我正在使用C2DM-Sharp庫爲Android創建推送通知服務器。 我已經創建了一個示例代碼來測試推送通知,但在關閉連接時,代碼發出錯誤「發生了一個或多個錯誤」。 「任務被取消了。」以下是我的代碼Android(c2dm)推送通知錯誤
C2dmService服務;
//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
如果我們評論service.stop()方法比它也會工作,否則把它放在try catch塊和keepint catch塊中也可以工作 – 2011-08-08 10:25:02