added a check for deviceToken in appDelegate