0

何らかの理由で、ブラックベリー カーブでプッシュ サービスを登録しようとすると、PushApplicationStatus.STATUS_NOT_REGISTERED が発生し続けます。トーチ、ストームではうまく機能しますが、ボールドとカーブでは非常に問題があります。

プッシュサービスに登録する方法のコードは次のとおりです。

int port = Constant.Net.PUSH_PORT;
    String appId = Constant.Net.APP_PUSH_ID;
    String bpasUrl = Constant.Net.BPAS_URL;
    ApplicationDescriptor ad = ApplicationDescriptor.currentApplicationDescriptor();
    byte serverType = PushApplicationDescriptor.SERVER_TYPE_BPAS;

    PushApplicationDescriptor pad = new PushApplicationDescriptor(appId, port, bpasUrl, serverType, ad);
    PushApplicationStatus status = PushApplicationRegistry.getStatus(pad);
    byte bstatus = status.getStatus();

    if (bstatus == PushApplicationStatus.STATUS_ACTIVE)
    {
        L.devout("BpasProtocol: already registered");
        AlertDialog.alert(LH.getString(LH.LBL_PUSH_REGISTERED));
        return;
    }
    else if (bstatus == PushApplicationStatus.STATUS_PENDING)
    {
        L.devout("BpasProtocol: status pending");
        AlertDialog.alert(LH.getString(LH.LBL_PUSH_REGISTERED));
        return;
    }
    else if (bstatus == PushApplicationStatus.REASON_REJECTED_BY_SERVER )
    {
        L.devout("BpasProtocol: rejected by server");
        AlertDialog.alert("REASON_REJECTED_BY_SERVER");
        return;
    }
    else if (bstatus == PushApplicationStatus.REASON_INVALID_PARAMETERS )
    {
        L.devout("BpasProtocol: REASON_INVALID_PARAMETERS");
        AlertDialog.alert("REASON_INVALID_PARAMETERS");
        return;
    }
    else if (bstatus == PushApplicationStatus.REASON_SIM_CHANGE )
    {
        L.devout("BpasProtocol: REASON_SIM_CHANGE");
        AlertDialog.alert("REASON_SIM_CHANGE");
        return;
    }
    else if (bstatus == PushApplicationStatus.REASON_NETWORK_ERROR )
    {
        L.devout("BpasProtocol: REASON_NETWORK_ERROR");
        AlertDialog.alert("REASON_NETWORK_ERROR");
        return;
    }
    else if (bstatus == PushApplicationStatus.REASON_API_CALL )
    {
        L.devout("BpasProtocol: REASON_API_CALL");
        AlertDialog.alert("REASON_API_CALL");
        return;
    }
    else if (bstatus == PushApplicationStatus.STATUS_NOT_REGISTERED )
    {
        L.devout("BpasProtocol: Status not registered");
        AlertDialog.alert("STATUS_NOT_REGISTERED");

        return;
    }
    else if (bstatus == PushApplicationStatus.STATUS_FAILED )
    {
        L.devout("BpasProtocol: Status failed");
        return;
    }
    else
    {
        L.devout("BpasProtocol: scheduling registration");

        PushApplicationRegistry.registerApplication(pad);
        AlertDialog.alert(LH.getString(LH.LBL_PUSH_REGISTERED));
    }

RIM からの応答を得るには永遠に時間がかかるため、どんな助けも大歓迎です。

4

1 に答える 1

0

PushApplicationStatus.getStatus()は、STATUS_PENDING、STATUS_ACTIVE、STATUS_FAILED、またはSTATUS_NOT_REGISTEREDのいずれかを返します。

このステータス値をREASON_*定数と比較する必要はないと思います。

また、ステータスがSTATUS_NOT_REGISTEREDの場合は、アプリケーションの登録を試みる必要があります。あなたのコードはelse-branchで登録を行いますが、4つのSTATUS_ *値の1つが一致しているはずなので、これに到達することはありません。

BlackBerry PushServiceSDKに付属しているsample-push-enabled-appをご覧ください。完全なソースコードはjarファイルにあります:sample-push-enabled-app-1.0.1.11-sources.jar

于 2011-06-16T09:05:02.803 に答える