diff --git a/message/output/airnotifier/classes/manager.php b/message/output/airnotifier/classes/manager.php index 1654857e985..f75ee8577cd 100644 --- a/message/output/airnotifier/classes/manager.php +++ b/message/output/airnotifier/classes/manager.php @@ -92,7 +92,7 @@ class message_airnotifier_manager { array('userdeviceid' => $device->id))) { // We have to create the device token in airnotifier. - if (! $this->create_token($device->pushid)) { + if (! $this->create_token($device->pushid, $device->platform)) { continue; } @@ -149,9 +149,10 @@ class message_airnotifier_manager { /** * Create a device token in the Airnotifier instance * @param string $token The token to be created + * @param string $deviceplatform The device platform (Android, iOS, iOS-fcm, etc...) * @return bool True if all was right */ - private function create_token($token) { + private function create_token($token, $deviceplatform = '') { global $CFG; if (!$this->is_system_configured()) { @@ -165,7 +166,10 @@ class message_airnotifier_manager { 'X-AN-APP-KEY: ' . $CFG->airnotifieraccesskey); $curl = new curl; $curl->setHeader($header); - $params = array(); + $params = []; + if (!empty($deviceplatform)) { + $params["device"] = $deviceplatform; + } $resp = $curl->post($serverurl, $params); if ($token = json_decode($resp, true)) {