public function send(MessageInterface $message)
    {
        if (!$message instanceof AndroidMessage) {
            throw new InvalidMessageTypeException(sprintf("Message type '%s' not supported by C2DM", get_class($message)));
        }

        if ($this->getAuthToken()) {
            $headers[] = "Authorization: GoogleLogin auth=" . $this->authToken;
            $data = $message->getMessageBody();

            $buzz = new Browser();
            $buzz->getClient()->setVerifyPeer(false);
            $buzz->getClient()->setTimeout($this->timeout);
            $response = $buzz->post("https://android.apis.google.com/c2dm/send", $headers, http_build_query($data));

            return preg_match("/^id=/", $response->getContent()) > 0;
        }

        return false;
    }
public function send(MessageInterface $message)
    {
        if (!$message instanceof AndroidMessage) {
            throw new InvalidMessageTypeException(sprintf("Message type '%s' not supported by C2DM", get_class($message)));
        }

        if ($this->getAuthToken()) {
            $headers[] = "Authorization: GoogleLogin auth=" . $this->authToken;
            $data = $message->getMessageBody();

            $buzz = new Browser();
            $buzz->getClient()->setVerifyPeer(false);
            $buzz->getClient()->setTimeout($this->timeout);
            $response = $buzz->post("https://android.apis.google.com/c2dm/send", $headers, http_build_query($data));

            return preg_match("/^id=/", $response->getContent()) > 0;
        }

        return false;
    }
public function send ( MessageInterface $ message ) { if ( ! $ message instanceof AndroidMessage ) { throw new InvalidMessageTypeException ( sprintf ( "Message type '%s' not supported by C2DM" , get_class ( $ message ) ) ) ; } if ( $ this -> getAuthToken ( ) ) { $ headers [ ] = "Authorization: GoogleLogin auth=" . $ this -> authToken ; $ data = $ message -> getMessageBody ( ) ; $ buzz = new Browser ( ) ; $ buzz -> getClient ( ) -> setVerifyPeer ( false ) ; $ buzz -> getClient ( ) -> setTimeout ( $ this -> timeout ) ; $ response = $ buzz -> post ( "https://android.apis.google.com/c2dm/send" , $ headers , http_build_query ( $ data ) ) ; return preg_match ( "/^id=/" , $ response -> getContent ( ) ) > 0 ; } return false ; }
Sends a C2DM message
This assumes that a valid auth token can be obtained

@param  \RMS\PushNotificationsBundle\Message\MessageInterface              $message
@throws \RMS\PushNotificationsBundle\Exception\InvalidMessageTypeException
@return bool
Sends a C2DM message This assumes that a valid auth token can be obtained