sendFCM('Уведомление', $account->getFullname().' хочет с вами подружиться.\n\nНажмите на уведомление, чтобы принять или отклонить заявку', $profileInfo['FCM'], '/account/notifications');
Пробовал \n, но пользователю так и приходит:
Вася Пупкин хочет с вами подружиться.\n\nНажмите на уведомление, чтобы принять или отклонить заявку
function sendFCM($title, $msg, $token, $urls = '') {
$url = 'https://fcm.googleapis.com/fcm/send';
$fields = array (
'to' => $token,
'notification' => array (
"body" => $msg,
"title" => $title,
"sound" => "default",
'priority' => 'high',
"icon" => "myicon",
),
'data' => array (
"url" => $urls
)
);
$fields = json_encode($fields);
$headers = array (
'Authorization: key=' . "122342",
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $fields);
$result = curl_exec($ch);
curl_close($ch);
}