/** * Build the GCM message * * @param notification $notification * @return string */ public static function buildGcmMessage(notification $notification) { $gcmMessage = array('message' => $notification->getContent('message'), 'vibrate' => 1, 'sound' => 1); $gcmFields = array('delay_while_idle' => true, 'registration_ids' => array($notification->getTo('deviceToken')), 'data' => $gcmMessage); return json_encode($gcmFields); }