Skip to content

Commit

Permalink
Fix Android multi-line messages
Browse files Browse the repository at this point in the history
  • Loading branch information
baptiste-dulac committed Mar 15, 2018
1 parent ab1d594 commit 28c1b51
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Sender/AndroidSender.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ private function sendBatch(array $devices, MessageInterface $message)
$data = [
'data' => [
"title" => $message->title(),
"message" => $message->message(),
"message" => trim(nl2br($message->message())),
"notId" => $message->id()
],
'registration_ids' => $devices,
];

$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $data ) );
$result = curl_exec($ch );
curl_close( $ch );
curl_setopt($ch,CURLOPT_URL, 'https://android.googleapis.com/gcm/send');
curl_setopt($ch,CURLOPT_POST, true);
curl_setopt($ch,CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch,CURLOPT_POSTFIELDS, json_encode($data));
$result = curl_exec($ch);
curl_close($ch);
}

public function send(MessageInterface $message): void
Expand Down

0 comments on commit 28c1b51

Please sign in to comment.