【问题标题】:Android (c2dm) push notification errorAndroid (c2dm) 推送通知错误
【发布时间】:2011-06-07 12:31:34
【问题描述】:

我正在使用 C2DM-Sharp 库为 android 创建一个推送通知服务器。 我创建了一个示例代码来测试推送通知,但是在关闭连接时,代码给出了错误“发生了一个或多个错误”。 “一个任务被取消了。”下面是我的代码

C2dmService服务;

        //Service emailid 
        var senderID = "myservice@gmail.com"; 
        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

【问题讨论】:

    标签: c# android android-c2dm


    【解决方案1】:

    我已经给出了所有认为与 android 中的 C2DM 服务相关的答案,请显示给定的链接

    C2DM permission.C2D_MESSAGE gives Installation error

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

    【讨论】:

    • 如果我们注释 service.stop() 方法,它也可以工作,否则将其放入 try catch 块和 keepint catch 块空也可以工作
    猜你喜欢
    • 2011-09-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-01-16
    • 1970-01-01
    • 1970-01-01
    • 2013-05-02
    相关资源
    最近更新 更多