php服务端发送推送消息能设置推送消息标题吗?声音?

jpush
标签: #<Tag:0x00007fb84db24618>

(yy) #1
public function send($_msg_body = 'Hello, JPush', $_alias = 'all', $_platform = 'all'){
            $client = new \JPush\Client($this->_key, $this->_secret);        
            $pusher = $client->push();
            $pusher->setPlatform($_platform );
            if(strtolower($_alias) == 'all'){
                $pusher->addAllAudience();
            }else{
                $pusher->addAlias($_alias);        
            }
            $pusher->setNotificationAlert($_msg_body);
            
            try {
                $_rs = $pusher->send();
            } catch (\JPush\Exceptions\JPushException $e) {
                $_rs = $e;
            }
            return $_rs;
        }

(yy) #2

这个是推送的方法,内容可以成功,就问一下标题和声音可以设置吗?


#3

参考PHP SDK的example


(yy) #4

可以设置标题吗?


(yy) #5

推送给ios可以设置标题吗


#6

(yy) #7

我现在php服务端,想给ios推送消息,需要标题,声音,消息内容,和一个标签


(yy) #8

我现在php服务端,想给ios推送消息,需要标题,声音,消息内容,和一个参数


(yy) #9
public function send($_msg_body = 'Hello, JPush', $_alias = 'all', $_flag = '', $_platform = 'all'){
            $client = new \JPush\Client($this->_key, $this->_secret);        
            $pusher = $client->push();

            $pusher->setPlatform($_platform );
            if(strtolower($_alias) == 'all'){
                $pusher->addAllAudience();
            }else{
                $pusher->addAlias($_alias);        
            }
            $pusher->setNotificationAlert($_msg_body);
            
            $pusher->iosNotification($_msg_body, array(
                        'sound' => 'sound.caf',
                        // 'badge' => '+1',
                        // 'content-available' => true,
                        // 'mutable-content' => true,
                        'category' => 'jiguang',
                        'extras' => array(
                            $_flag
                        ),
                    ));
      
            try {
                $_rs = $pusher->send();
            } catch (\JPush\Exceptions\JPushException $e) {
                $_rs = $e;
            }
            return $_rs;
        }

(yy) #10

声音这样对吗?为什么ios那边收到的是 一个字符串


#11

自定义声音是需要客户端配合的