Google日历推送通知不会在删除

时间:2017-06-14 08:02:19

标签: php api push-notification google-calendar-api

我已注册推送通知。更新和创建工作正常,但我无法接收已删除的事件。

我正在设置这样的频道

    public function setUpPushNotificationsChannel($lengthHours = 168){
        $this->cancelPushNotificationsChannel();
        $channel = new Google_Service_Calendar_Channel();
        $channel->setId(create_guid());
        $channel->setType('web_hook');
        $channel->setAddress( $this->url);
        $channel->setToken(Utils::encrypt($this->pushSecret);
        $dateTime = new DateTime();
        $dateTime->add(date_interval_create_from_date_string("$lengthHours hours"));
        //timestamp is in milliseconds for google -.-
        $channel->setExpiration($dateTime->getTimestamp() * 1000);
        //this does not do anything
        $optParams = array(
            'singleEvents' => true,
            'showDeleted' =>true,
        );
        $channel = $this->service->events->watch($this->getGoogleCalendarId(),$channel,$optParams);
        $this->gcalendarSetting->gcalendar_push_channel_id_c = $channel->getId();
        $this->gcalendarSetting->gcalendar_resource_id_c = $channel->getResourceId();
        $this->gcalendarSetting->save();
    }

我在google doc中找不到任何内容,也许我错过了一些已删除事件的参数? 感谢

1 个答案:

答案 0 :(得分:0)

事实证明,问题不在于已删除的事件,而是在所有事件中。这些通知通常都没有到达,我在测试时运气不好。似乎几乎有50%的变化没有被推动,这是非常不满意的。