<?php 
include_once realpath(dirname(__FILE__) . '/admin-class.php');
$admin = new itg_admin();
$pushTosend = array();
$offlineUsers = $admin->getOfflineUsers();
$allUsers = $admin->getAllUsers();
$androidToken = array();
foreach ($allUsers as $alluser) {
    foreach ($offlineUsers as $offline) {
        if (in_array(strtoupper($offline['username']), $alluser)) {
            $pushTosend[] = $alluser;
        }
    }
}
foreach ($pushTosend as $value) {
    if ($value['is_on_track'] == 1) {
        if ($value['devicetype'] == 'ios') {
            iosPush($value['token']);
        }
        if ($value['devicetype'] == 'android') {
            $androidToken[] = $value['token'];
        }
    }
}
sendPushNotification($androidToken);
function iosPush($token)
{
    try {
        $deviceToken = $token;