Beispiel #1
0
}
try {
    //查询某个用户是否在tag下
    $result = $client->isDeviceInTag($REGISTRATION_ID1, $TAG1);
    $payload = $result->body;
    echo '<b>isDeviceInTag</b>' . $br;
    echo 'isDeviceInTag:' . json_encode($payload['result']) . $br;
    echo $br;
} catch (APIRequestException $e) {
    printAPIRequestErrorStack($e);
} catch (APIConnectionException $e) {
    printAPIConnectionErrorStack($e);
}
try {
    //对指定tag添加或者删除registrationId
    $result = $client->updateTagDevices($TAG1, array($REGISTRATION_ID1), array($REGISTRATION_ID2));
    echo '<b>updateTagDevices</b>' . $br;
    if ($result->isOk) {
        echo 'Update Tag Devices Success' . $br;
    } else {
        echo 'Update Tag Devices Fail' . $br;
    }
    echo $br;
} catch (APIRequestException $e) {
    printAPIRequestErrorStack($e);
} catch (APIConnectionException $e) {
    printAPIConnectionErrorStack($e);
}
try {
    //删除指定Tag,以及与其关联的用户之间的关联关系
    $result = $client->deleteTag($TAG2);
Beispiel #2
0
 function testUpdateTagDevices()
 {
     $client = new JPushClient($this->appKey, $this->masterSecret);
     $result = $client->updateTagDevices($this->TAG1, array($this->REGISTRATION_ID1), array($this->REGISTRATION_ID2));
     $this->assertTrue($result->isOk === true);
 }