public function notify($interests, array $data, $debug = false)
    {
        $postData = [];

        if (is_string($interests)) {
            $interests = [$interests];
        }

        if (count($interests) == 0) {
            throw new ExpoException('Interests array must not be empty.');
        }

        // Gets the expo tokens for the interests
        $recipients = $this->registrar->getInterests($interests);

        foreach ($recipients as $token) {
            $postData[] = $data + ['to' => $token];
        }

        $ch = $this->prepareCurl();

        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData));

        $response = $this->executeCurl($ch);

        // If the notification failed completely, throw an exception with the details
        if (!$debug && $this->failedCompletely($response, $interests)) {
            throw ExpoException::failedCompletelyException($response);
        }

        return $response;
    }
public function notify($interests, array $data, $debug = false)
    {
        $postData = [];

        if (is_string($interests)) {
            $interests = [$interests];
        }

        if (count($interests) == 0) {
            throw new ExpoException('Interests array must not be empty.');
        }

        // Gets the expo tokens for the interests
        $recipients = $this->registrar->getInterests($interests);

        foreach ($recipients as $token) {
            $postData[] = $data + ['to' => $token];
        }

        $ch = $this->prepareCurl();

        curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($postData));

        $response = $this->executeCurl($ch);

        // If the notification failed completely, throw an exception with the details
        if (!$debug && $this->failedCompletely($response, $interests)) {
            throw ExpoException::failedCompletelyException($response);
        }

        return $response;
    }
public function notify ( $ interests , array $ data , $ debug = false ) { $ postData = [ ] ; if ( is_string ( $ interests ) ) { $ interests = [ $ interests ] ; } if ( count ( $ interests ) == 0 ) { throw new ExpoException ( 'Interests array must not be empty.' ) ; } // Gets the expo tokens for the interests $ recipients = $ this -> registrar -> getInterests ( $ interests ) ; foreach ( $ recipients as $ token ) { $ postData [ ] = $ data + [ 'to' => $ token ] ; } $ ch = $ this -> prepareCurl ( ) ; curl_setopt ( $ ch , CURLOPT_POSTFIELDS , json_encode ( $ postData ) ) ; $ response = $ this -> executeCurl ( $ ch ) ; // If the notification failed completely, throw an exception with the details if ( ! $ debug && $ this -> failedCompletely ( $ response , $ interests ) ) { throw ExpoException :: failedCompletelyException ( $ response ) ; } return $ response ; }
Send a notification via the Expo Push Notifications Api.

@param $interests
@param array $data
@param bool $debug

@throws ExpoException

@return array|bool
Send a notification via the Expo Push Notifications Api .