我正在尝试通过php向每个registration_ids
发送不同的声音
每当我使用自定义声音发送给某个令牌时,我都试图在循环中执行此操作,但是由于我有很多registration_ids
,它被延迟了。
这是我的代码:
<?php
$payload = array(
'registration_ids'=>array('TOKEN_1','TOKEN_2'),
'priority'=>'high',
"mutable_content"=>true,
"notification"=>array(
"title"=> 'TEST',
"body"=> 'TEST',
"sound"=> ["1.wav", "2.wav"]
)
);
$headers = array(
'Authorization:key = AIza.....',
'Content-Type: application/json'
);
$ch = curl_init();
curl_setopt( $ch,CURLOPT_URL, 'https://fcm.googleapis.com/fcm/send' );
curl_setopt( $ch,CURLOPT_POST, true );
curl_setopt( $ch,CURLOPT_HTTPHEADER, $headers );
curl_setopt( $ch,CURLOPT_RETURNTRANSFER, true );
curl_setopt( $ch,CURLOPT_SSL_VERIFYPEER, false );
curl_setopt( $ch,CURLOPT_POSTFIELDS, json_encode( $payload ) );
$result = curl_exec($ch );
curl_close( $ch );