Skip to content

Change token settings

Change the language and notification consent of a registered device token, or detach the user identifier linked to the token. All three methods identify the target token by the token value in the request body, and the server processes the request asynchronously after accepting it (202).

Note
  • Changing token settings uses the logged-in session. You must complete login before calling these methods.
  • For Token, pass the same device token value that you used for token registration.

Change the token language

Method

public Task PatchTokenLanguageAsync();


Changes the language code of the device token. The changed language code is used to localize the language of notification messages. Call this method when the user changes the language setting in the app.


Call parameters

Category Type Variable name Description
Input PatchTokenLanguageRequest request Request object that contains the target token and the language code to apply.
Input ApiCallContext context (Optional) Per-call settings object. If omitted, the default values are used.

PatchTokenLanguageRequest

Variable name Type Required Description
Token string Required The device token value used for registration.
Language LanguageCode Required The language code to apply. Specify it as an enum member (for example, LanguageCode.En).


Call example

using Hive.Axyl.Push;
using Hive.Axyl.Core;

IPushService push = HiveCore.Resolve<IPushService>();

PushPatchTokenLanguageResult result = await push.PatchTokenLanguageAsync(
    new PatchTokenLanguageRequest {
        Token    = fcmToken,
        Language = LanguageCode.En,
    });

switch (result)
{
    case PushPatchTokenLanguageResult.Success:
        // Change request accepted (202). The server processes it asynchronously.
        break;

    case PushPatchTokenLanguageResult.ResourceNotInScope:
        // The requested App ID or resource cannot be used within the current project scope.
        break;

    case PushPatchTokenLanguageResult.InvalidSubject:
        // The user identifier of the login session cannot be used.
        break;

    // Handle common failures — for the detailed error model, see [Error handling](PLACEHOLDER_에러처리_링크)
    case PushPatchTokenLanguageResult.Failure failure:
        HiveError err = failure.Problem;
        Debug.LogError($"[{err.Code}] {err.Message} (trace: {err.TraceId})");
        break;

    // Safety net: unknown new results (UnknownOutcome)
    default:
        Debug.LogWarning($"Unhandled result: {result.GetType().Name}");
        break;
}


Response status

The returned PushPatchTokenLanguageResult object branches into the following cases. No response data is returned on success.

Response case Description App client handling
Success The change request was accepted (202). The server processes it asynchronously. Treat the change as complete
ResourceNotInScope The requested App ID or resource cannot be used within the current project scope. Check the project and App ID settings
InvalidSubject The user identifier cannot be confirmed from the login session. Check the login status and retry
Failure A network error, server error, or common failure response. Request value validation errors are passed in ExternalCode of Problem (HiveError) as values such as invalid_parameter, missing_field, and bad_request. Check ExternalCode, then fix the request values or retry

Change notification consent

Method

public Task PatchTokenAgreementAsync();


Changes the notification consent settings of the device token. Instead of sending only the items to change, this method sends all three item values and replaces them as a whole, so you must also fill in the items you do not change with their current values. Call this method when the user changes the notification settings in the app.


Call parameters

Category Type Variable name Description
Input PatchTokenAgreementRequest request Request object that contains the target token and all notification consent values to apply.
Input ApiCallContext context (Optional) Per-call settings object. If omitted, the default values are used.

PatchTokenAgreementRequest

Variable name Type Required Description
Token string Required The device token value used for registration.
Agreement Agreement Required The notification consent settings to apply. Fill in all three item values.

Agreement

Variable name Type Required Description
Info bool Required Consent to receive informational notifications.
Advertise bool Required Consent to receive advertising notifications.
Night bool Required Consent to receive nighttime advertising notifications. Cannot be set to true if Advertise is false.


Call example

using Hive.Axyl.Push;
using Hive.Axyl.Core;

IPushService push = HiveCore.Resolve<IPushService>();

PushPatchTokenAgreementResult result = await push.PatchTokenAgreementAsync(
    new PatchTokenAgreementRequest {
        Token     = fcmToken,
        Agreement = new Agreement {   // Fill in the items you do not change with their current values as well.
            Info      = true,
            Advertise = true,
            Night     = false,
        },
    });

switch (result)
{
    case PushPatchTokenAgreementResult.Success:
        // Change request accepted (202). The server processes it asynchronously.
        break;

    case PushPatchTokenAgreementResult.ResourceNotInScope:
        // The requested App ID or resource cannot be used within the current project scope.
        break;

    case PushPatchTokenAgreementResult.InvalidSubject:
        // The user identifier of the login session cannot be used.
        break;

    // Handle common failures — for the detailed error model, see [Error handling](PLACEHOLDER_에러처리_링크)
    case PushPatchTokenAgreementResult.Failure failure:
        HiveError err = failure.Problem;
        Debug.LogError($"[{err.Code}] {err.Message} (trace: {err.TraceId})");
        break;

    // Safety net: unknown new results (UnknownOutcome)
    default:
        Debug.LogWarning($"Unhandled result: {result.GetType().Name}");
        break;
}


Response status

The returned PushPatchTokenAgreementResult object branches into the following cases. No response data is returned on success.

Response case Description App client handling
Success The change request was accepted (202). The server processes it asynchronously. Treat the change as complete
ResourceNotInScope The requested App ID or resource cannot be used within the current project scope. Check the project and App ID settings
InvalidSubject The user identifier cannot be confirmed from the login session. Check the login status and retry
Failure A network error, server error, or common failure response. Request value validation errors are passed in ExternalCode of Problem (HiveError) as values such as invalid_parameter, missing_field, and bad_request. Check ExternalCode, then fix the request values or retry

Detach the token identifier

Method

public Task DetachTokenIdentifierAsync();


Detaches only the user identifier (Player ID) linked to the token. Because the token data itself is not deleted, the device can continue to receive notifications that are not targeted at a user (for example, sends to all users) even after detachment. Call this method when you need to disconnect the current user from the device because of logout or account switching.


Call parameters

Category Type Variable name Description
Input DetachTokenIdentifierRequest request Request object that contains the target token to detach.
Input ApiCallContext context (Optional) Per-call settings object. If omitted, the default values are used.

DetachTokenIdentifierRequest

Variable name Type Required Description
Token string Required The device token value used for registration.


Call example

using Hive.Axyl.Push;
using Hive.Axyl.Core;

IPushService push = HiveCore.Resolve<IPushService>();

PushDetachTokenIdentifierResult result = await push.DetachTokenIdentifierAsync(
    new DetachTokenIdentifierRequest {
        Token = fcmToken,
    });

switch (result)
{
    case PushDetachTokenIdentifierResult.Success:
        // Detach request accepted (202). The server processes it asynchronously.
        break;

    case PushDetachTokenIdentifierResult.ResourceNotInScope:
        // The requested App ID or resource cannot be used within the current project scope.
        break;

    case PushDetachTokenIdentifierResult.InvalidSubject:
        // The user identifier of the login session cannot be used.
        break;

    // Handle common failures — for the detailed error model, see [Error handling](PLACEHOLDER_에러처리_링크)
    case PushDetachTokenIdentifierResult.Failure failure:
        HiveError err = failure.Problem;
        Debug.LogError($"[{err.Code}] {err.Message} (trace: {err.TraceId})");
        break;

    // Safety net: unknown new results (UnknownOutcome)
    default:
        Debug.LogWarning($"Unhandled result: {result.GetType().Name}");
        break;
}


Response status

The returned PushDetachTokenIdentifierResult object branches into the following cases. No response data is returned on success.

Response case Description App client handling
Success The detach request was accepted (202). The server processes it asynchronously. Treat the detachment as complete
ResourceNotInScope The requested App ID or resource cannot be used within the current project scope. Check the project and App ID settings
InvalidSubject The user identifier cannot be confirmed from the login session. Check the login status and retry
Failure A network error, server error, or common failure response. Request value validation errors are passed in ExternalCode of Problem (HiveError) as values such as invalid_parameter, missing_field, and bad_request. Check ExternalCode, then fix the request values or retry

The documents related to the content of this document are as follows.