Beispiel #1
0
    echo 'rateLimitLimit : ' . $e->rateLimitLimit . $br;
    echo 'rateLimitRemaining : ' . $e->rateLimitRemaining . $br;
    echo 'rateLimitReset : ' . $e->rateLimitReset . $br;
}
function printAPIConnectionErrorStack($e)
{
    $br = '<br/>';
    echo 'Push Fail: ' . $br;
    echo 'Error Message: ' . $e->getMessage() . $br;
    //response timeout means your request has probably be received by JPUsh Server,please check that whether need to be pushed again.
    echo 'IsResponseTimeout: ' . $e->isResponseTimeout . $br;
}
/*----Devices Example----*/
try {
    //获取当前用户的所有属性,包含tags, alias。
    $result = $client->getDeviceTagAlias($REGISTRATION_ID1);
    $payload = $result->body;
    echo '<b>getDeviceTagAlias</b>' . $br;
    echo '----Alias:' . $payload['alias'] . $br;
    echo '----Tags:' . json_encode($payload['tags']) . $br;
    echo $br;
} catch (APIRequestException $e) {
    printAPIRequestErrorStack($e);
} catch (APIConnectionException $e) {
    printAPIConnectionErrorStack($e);
}
try {
    //移除指定RegistrationId的所有alias
    $result = $client->removeDeviceAlias($REGISTRATION_ID1);
    echo '<b>removeDeviceAlias</b>' . $br;
    if ($result->isOk) {
Beispiel #2
0
 function testGetDeviceTagAlias()
 {
     $client = new JPushClient($this->appKey, $this->masterSecret);
     $result = $client->getDeviceTagAlias($this->REGISTRATION_ID1);
     $this->assertTrue($result->isOk === true);
 }