2017-03-12 44 views
0

因此,我正在開發一個應用程序,需要推送通知,我使用pushwoosh。但目前我堅持如何通過標籤值向設備發送有針對性的通知。
我正在使用[http://gomoob.github.io/php-pushwoosh/]
任何幫助將不勝感激。感謝發送通知到設備使用按標籤值使用pushwoosh

$filter = ''; 
$request = CreateTargetedMessageRequest::create() 
->setContent($options['body']) 
->setData(
    [ 
     'custom' => 'json data' 
    ] 
) 
->setDevicesFilter($filter); 
$pushwoosh->createTargetedMessage($request); 

我想是爲過濾

+0

你能告訴我們一些代碼嗎?你試過什麼了? – ventiseis

回答

0

我最終解決它自己的價值。我使用setCondition()方法來指定我想要的標籤名稱和值。

$request = CreateMessageRequest::create() 
    ->addNotification(Notification::create() 

     ->setContent($options['body']) 
     ->setConditions([ 
      IntCondition::create('userId')->eq($user_id) 
     ])); 


// Call the REST Web Service 
$response = $pushwoosh->createMessage($request); 
相關問題