src/php/NotifyMyAndroid.php
protected function send()
    {
        try {
            $options = $this->getOptions();

            $message = sprintf(
                'Service: %2$s' . PHP_EOL .
                'Host: %3$s' . PHP_EOL .
                'State: %5$s' . PHP_EOL .
                'Message: %7$s',
                $options['type'],
                $options['service'],
                $options['host'],
                $options['address'],
                $options['state'],
                $options['time'],
                $options['output']
            );

            $priority = $this->determinePriority($options['state']);

            // verify API key
            $this->nmaClient->verify();

            // send notification
            $this->nmaClient->notify(
                self::SENDER,
                $options['type'],
                $message,
                $priority,
                'anag://open?updateonreceive=true'
            );

            $this->setMessage('Message was sent');
            $this->setCode(self::STATE_OK);
        } catch (Exception $e) {
            $this->setMessage(
                'Message could not be sent. Error from NMA client: ' .
                $e->getMessage()
            );
            $this->setCode(self::STATE_CRITICAL);
        }

        return $this;
    }
protected function send()
    {
        try {
            $options = $this->getOptions();

            $message = sprintf(
                'Service: %2$s' . PHP_EOL .
                'Host: %3$s' . PHP_EOL .
                'State: %5$s' . PHP_EOL .
                'Message: %7$s',
                $options['type'],
                $options['service'],
                $options['host'],
                $options['address'],
                $options['state'],
                $options['time'],
                $options['output']
            );

            $priority = $this->determinePriority($options['state']);

            // verify API key
            $this->nmaClient->verify();

            // send notification
            $this->nmaClient->notify(
                self::SENDER,
                $options['type'],
                $message,
                $priority,
                'anag://open?updateonreceive=true'
            );

            $this->setMessage('Message was sent');
            $this->setCode(self::STATE_OK);
        } catch (Exception $e) {
            $this->setMessage(
                'Message could not be sent. Error from NMA client: ' .
                $e->getMessage()
            );
            $this->setCode(self::STATE_CRITICAL);
        }

        return $this;
    }
protected function send ( ) { try { $ options = $ this -> getOptions ( ) ; $ message = sprintf ( 'Service: %2$s' . PHP_EOL . 'Host: %3$s' . PHP_EOL . 'State: %5$s' . PHP_EOL . 'Message: %7$s' , $ options [ 'type' ] , $ options [ 'service' ] , $ options [ 'host' ] , $ options [ 'address' ] , $ options [ 'state' ] , $ options [ 'time' ] , $ options [ 'output' ] ) ; $ priority = $ this -> determinePriority ( $ options [ 'state' ] ) ; // verify API key $ this -> nmaClient -> verify ( ) ; // send notification $ this -> nmaClient -> notify ( self :: SENDER , $ options [ 'type' ] , $ message , $ priority , 'anag://open?updateonreceive=true' ) ; $ this -> setMessage ( 'Message was sent' ) ; $ this -> setCode ( self :: STATE_OK ) ; } catch ( Exception $ e ) { $ this -> setMessage ( 'Message could not be sent. Error from NMA client: ' . $ e -> getMessage ( ) ) ; $ this -> setCode ( self :: STATE_CRITICAL ) ; } return $ this ; }
Sends the notification to the given Android device.

@return $this
Sends the notification to the given Android device .