Skip to main content

Message Reception Settings

Changes the reception settings for push messages.

URL Verification

This API uses the service-api.playnanoo.com domain.

API Information

  • URL: https://service-api.playnanoo.com/push/v20220701/change
  • Method: PUT
  • Authentication Required: Yes
DeviceInfo Inheritance

The Req class of this API inherits from DeviceInfo. All properties of DeviceInfo are automatically included.

Request Parameters

ParameterTypeRequiredDescription
receive_ynstringRequiredWhether to receive push messages ("Y" or "N")
receive_night_ynstringRequiredWhether to receive night push messages ("Y" or "N")
Night Push

Night push refers to push messages from 9 PM to 8 AM the next day.

Response Data

Res Class

FieldTypeDescription
StatusstringProcessing result status

Unity C# Implementation

BaseResponse Class

The base class for all API responses.

public class BaseResponse
{
public string ErrorCode;
public string Message;
public string WithdrawalKey;
public string BlockKey;
}

Field descriptions:

  • ErrorCode: Error code
  • Message: Error message
  • WithdrawalKey: Key required for recovery if in withdrawal grace period (provided only for accounts in withdrawal grace period)
  • BlockKey: Key provided for blocked accounts (provided only for blocked accounts)

Push Settings Change Class

using System;
using System.Collections;
using UnityEngine.Networking;

public class PushChange
{
static string url = "https://service-api.playnanoo.com/push/v20220701/change";

[Serializable]
public class Req : DeviceInfo
{
public string receive_yn;
public string receive_night_yn;

public IEnumerator Send(
bool receiveYn,
bool receiveNightYn,
Action<Res> onSuccess,
Action<BaseResponse> onError)
{
this.receive_yn = receiveYn ? "Y" : "N";
this.receive_night_yn = receiveNightYn ? "Y" : "N";

// PUT method call
yield return HttpClient.Send<Req, Res>(
UnityWebRequest.kHttpVerbPUT,
url,
requireToken: true,
body: this,
onSuccess: onSuccess,
onError: onError
);
}
}

[Serializable]
public class Res : BaseResponse
{
public string Status;
}
}

Usage Examples

Completely Disable Push Notifications

using PlayNANOO;

public class PlayNANOOExample : MonoBehaviour
{
void DisableAllPush()
{
PushChange.Req req = new PushChange.Req();

StartCoroutine(req.Send(
receiveYn: false,
receiveNightYn: false,
onSuccess: res =>
{
Debug.Log($"Push notifications disabled successfully: {res.Status}");
},
onError: (error) =>
{
Debug.LogError($"Failed to change push settings: [{error.ErrorCode}] [{error.Message}]");
}
));
}
}

Disable Night Push Only

using PlayNANOO;

public class PlayNANOOExample : MonoBehaviour
{
void DisableNightPush()
{
PushChange.Req req = new PushChange.Req();

StartCoroutine(req.Send(
receiveYn: true,
receiveNightYn: false,
onSuccess: res =>
{
Debug.Log($"Night push disabled successfully: {res.Status}");
},
onError: (error) =>
{
Debug.LogError($"Failed to change push settings: [{error.ErrorCode}] [{error.Message}]");
}
));
}
}

Change Based on User Settings

using PlayNANOO;

public class PushSettingsUI : MonoBehaviour
{
public Toggle pushToggle;
public Toggle nightPushToggle;

public void OnSettingsChanged()
{
PushChange.Req req = new PushChange.Req();

StartCoroutine(req.Send(
receiveYn: pushToggle.isOn,
receiveNightYn: nightPushToggle.isOn,
onSuccess: res =>
{
Debug.Log($"Push settings changed successfully: {res.Status}");
ShowMessage("Push notification settings have been changed.");
},
onError: (error) =>
{
Debug.LogError($"Failed to change push settings: [{error.ErrorCode}] [{error.Message}]");
ShowMessage("Failed to change settings. Please try again.");
}
));
}

void ShowMessage(string message)
{
// Display UI message
Debug.Log(message);
}
}
Real-time Settings Application

Settings changed through this API are immediately reflected on the server and applied from the next push notification.

Token Retention

Changing settings does not delete the token but only changes the reception status. The token continues to be retained on the server.

User Experience

It is recommended to provide push notification settings UI so users can control notifications as they wish.