From 6b63036c13a81b34e77e82037907e3918341d596 Mon Sep 17 00:00:00 2001 From: Daniel Barnett Date: Wed, 17 Feb 2016 16:29:54 -0600 Subject: [PATCH] Allow android device tokens to be created --- message/output/airnotifier/classes/manager.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/message/output/airnotifier/classes/manager.php b/message/output/airnotifier/classes/manager.php index f395c28..ac87908 100644 --- a/message/output/airnotifier/classes/manager.php +++ b/message/output/airnotifier/classes/manager.php @@ -89,7 +89,7 @@ public function get_user_devices($appname, $userid = null) { 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; } @@ -147,7 +147,7 @@ public function request_accesskey() { * @param string $token The token to be created * @return bool True if all was right */ - private function create_token($token) { + private function create_token($token, $device) { global $CFG; if (!$this->is_system_configured()) { @@ -161,7 +161,10 @@ private function create_token($token) { 'X-AN-APP-KEY: ' . $CFG->airnotifieraccesskey); $curl = new curl; $curl->setHeader($header); - $params = array(); + $params = array( + 'token' => $token, + 'device' => $device + ); $resp = $curl->post($serverurl, $params); if ($resp = json_decode($resp, true)) {