I got a question about Google Cloud Messaging...
I send GCM to Google for 3 Registration IDs, then Google replies that 2 of the Registration IDs has been sent succes
Here's how I did it:
$gcm_result = $gcm->send_notification($registration_ids, $message);
$jsonArray = json_decode($gcm_result);
if(!empty($jsonArray->results)){
$remove_ids = array();
for($i=0; $iresults);$i++){
if(isset($jsonArray->results[$i]->error)){
if($jsonArray->results[$i]->error == "NotRegistered"){
$remove_ids[$i] = "'".$registration_ids[$i]."'";
}
}
}
if(!empty($remove_ids)){
$remove_ids_string = implode(', ',$remove_ids);
include_once SCRIPTS.'gcm_server_php/db_functions.php';
$dbf = new DB_Functions();
$res = $dbf->deleteUsers($remove_ids_string);
echo count($remove_ids)." users have unregistered from notifications since the last one was sent out.";
}
}