推送通知不适用于php的Android

时间:2019-01-25 06:10:47

标签: php push-notification

我正在尝试从 PHP Android 发送推送通知,我检查了我的项目号,API密钥和设备ID /设备令牌,所有凭据都正确,但是我出现以下错误:

 UIBarButtonItem *donebutton=[[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(Btn_DoneClick)];
    //    donebutton.style=UIBarButtonItemStylePlain;
donebutton.tintColor = [UIColor blueColor];

这是我的代码:

{"multicast_id":7219223859365110681,"success":0,"failure":1,"canonical_ids":0,"results":[{"error":"MismatchSenderId"}]}

我的代码有什么问题?

1 个答案:

答案 0 :(得分:0)

尝试更改此

$fields = array
 (
'registration_ids'  => $registrationIds,
'data'          => $msg
);

$fields = array
(
'to'  => 'XXXXXXXXXXX',//device token
'data'=> json_encode($msg)
);

还有这个

$headers = array
(
'Authorization: key=' . API_ACCESS_KEY,
'Content-Type: application/json'
 );

收件人:

$headers = array
(
'Authorization'=> 'key='. API_ACCESS_KEY,
'Content-Type'=> 'application/json'
);