rest API 下的 push Api方法 只推送给安卓用户

yanghongchang
2019-07-31 02:16 276 0

没有别名 也没有标签标示, 想吧信息推送给安卓用户,需要怎么改造

public function push_all_object($data,$platform = array('ios', 'android')){
         try{
            $response = $this->JPush->push()->setPlatform($platform);
            $response->options(['apns_production'=>false]);
            $response->iosNotification($data['message'], array(
                'sound' => 'sound.caf',
                'badge' => '+1',
                'extras' => $data['extras']
            ));
            $response->androidNotification($data['message'], array(
                'title' => $data['title'],
                'extras' => $data['extras']
            ));
            $result = $response->send();
            return $result;
        }catch(\APIConnectionException $e){
            return $e;
        }catch(\APIRequestException $e){
            return $e;
        }
    }

我书写的 提示增加推送设备

1个回答

热门排序
  • 仅推送给 Android,就只写 Android 平台 还有 Audience 没有写,你可以写推送给所有的Android用户,也可以根据需求设置别名标签后推送,给设备的 registrationID 也行 参考 examplehttps 展示全部