【发布时间】:2015-08-24 12:41:09
【问题描述】:
我的代码在这里 请仔细看 IOs gcm 不能在后台工作,只能在前台 php 脚本中工作
$data = array('message' =>$msg,
'contentTitle' => $msg,
"tickerText" => "some ticker text",
"contentTitle" => "some content title",
"contentText" => "some content description text",
"sound"=> "default",
"vibrate" => "false",
"otherCustomData" => "some value"
);
$fields = array(
'registration_ids' => $registrationIDs,
'data' => array("message" => $data),
'content_available' => true
);
//have to change
$headers = array(
'Authorization: key=IDSSSSSSS',
'Content-Type: application/json'
);
}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
// Disabling SSL Certificate support temporarly
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($fields));
// Execute post
$result = curl_exec($ch);
// print_r($result);
if ($result === FALSE)
{
die('Curl failed: ' . curl_error($ch));
}
// Close connection
curl_close($ch);
echo $result;
我的 Ios 开发人员对我说它只能在前台工作而不是在后台工作。这在 android 中正常工作 请速帮忙 提前致谢
【问题讨论】:
标签: php android ios google-cloud-messaging