ExperienceNotificationService

사용되지 않는 항목 표시

*이 콘텐츠는 AI(베타)를 사용해 번역되었으며, 오류가 있을 수 있습니다. 이 페이지를 영어로 보려면 여기를 클릭하세요.

만들 수 없음
서비스
복제되지 않음

경험 알림은 13+ 사용자가 시기적이고 개인화된 알림을 통해 좋아하는 경험을 유지할 수 있는 방법입니다.이 서비스에는 사용자를 확인하고 알림을 활성화하도록 요청하는 메서드가 포함되어 있습니다.

요약

메서드

  • 로컬 플레이어에게 경험 내 프롬프트를 표시하여 알림을 활성화합니다.

  • 로컬 플레이어가 알림을 활성화하도록 요청받을 수 있는지 여부를 나타냅니다.

속성

메서드

PromptOptIn

()

PromptOptIn() 로컬 플레이어에게 경험 내 모달을 통해 알림을 활성화하도록 요청합니다.이 메서드를 호출하기 전에 항상 CanPromptOptInAsync()의 결과를 사용해야 하는데, 플레이어의 나이나 경험에 대한 알림을 이미 활성화했는지와 같은 다양한 요소에 따라 메시지가 표시될 수 있기 때문입니다.

이 메서드는 항상 로컬 플레이어( )를 추론하고 이는 단지 에서 또는 에서 설정된 으로만 호출할 수 있습니다.

경험 알림을 참조하여 런치 데이터를 사용하여 알림을 구현하고 사용자 지정하는 등의 자세한 내용을 확인하세요.


반환

()

코드 샘플

LocalScript - Notification Permission Prompt Implementation

local ExperienceNotificationService = game:GetService("ExperienceNotificationService")
-- Function to check whether the player can be prompted to enable notifications
local function canPromptOptIn()
local success, canPrompt = pcall(function()
return ExperienceNotificationService:CanPromptOptInAsync()
end)
return success and canPrompt
end
local canPrompt = canPromptOptIn()
if canPrompt then
local success, errorMessage = pcall(function()
ExperienceNotificationService:PromptOptIn()
end)
end
-- Listen to opt-in prompt closed event
ExperienceNotificationService.OptInPromptClosed:Connect(function()
print("Opt-in prompt closed")
end)

CanPromptOptInAsync

생성

CanPromptOptInAsync() 로컬 플레이어가 알림 활성화를 요청받을 수 있는 경우 true 가 반환됩니다.이 메서드의 결과를 항상 사용해야 하는데, 왜냐하면 플레이어의 나이나 경험에 대한 알림을 이미 활성화했는지와 같은 다양한 요소에 따라 메시지가 표시될 수 있기 때문입니다.You should always use the result of this method before calling PromptOptIn() since the ability to be prompted depends on various factors like the player's age or whether they've already enabled notifications for your experience.

이 메서드는 항상 로컬 플레이어( )를 추론하고 이는 단지 에서 또는 에서 설정된 으로만 호출할 수 있습니다.또한 비동기 네트워크 호출이기 때문에 pcall()에서 호출해야 합니다, 때때로 실패할 수 있는 네트워크 호출입니다.

경험 알림을 참조하여 런치 데이터를 사용하여 알림을 구현하고 사용자 지정하는 등의 자세한 내용을 확인하세요.


반환

로컬 플레이어에게 알림 활성화를 요청할 수 있는지 여부.

코드 샘플

LocalScript - Notification Permission Prompt Implementation

local ExperienceNotificationService = game:GetService("ExperienceNotificationService")
-- Function to check whether the player can be prompted to enable notifications
local function canPromptOptIn()
local success, canPrompt = pcall(function()
return ExperienceNotificationService:CanPromptOptInAsync()
end)
return success and canPrompt
end
local canPrompt = canPromptOptIn()
if canPrompt then
local success, errorMessage = pcall(function()
ExperienceNotificationService:PromptOptIn()
end)
end
-- Listen to opt-in prompt closed event
ExperienceNotificationService.OptInPromptClosed:Connect(function()
print("Opt-in prompt closed")
end)

이벤트

OptInPromptClosed

이 이벤트는 로컬 플레이어가 PromptOptIn()를 통해 표시된 프롬프트를 닫을 때 발생합니다.연결할 수 있는 방법은 다음과 같습니다. LocalScript 또는 Script 에서 RunContextClient 로 설정하여 연결할 수 있습니다.

경험 알림을 참조하여 런치 데이터를 사용하여 알림을 구현하고 사용자 지정하는 등의 자세한 내용을 확인하세요.


코드 샘플

LocalScript - Notification Permission Prompt Implementation

local ExperienceNotificationService = game:GetService("ExperienceNotificationService")
-- Function to check whether the player can be prompted to enable notifications
local function canPromptOptIn()
local success, canPrompt = pcall(function()
return ExperienceNotificationService:CanPromptOptInAsync()
end)
return success and canPrompt
end
local canPrompt = canPromptOptIn()
if canPrompt then
local success, errorMessage = pcall(function()
ExperienceNotificationService:PromptOptIn()
end)
end
-- Listen to opt-in prompt closed event
ExperienceNotificationService.OptInPromptClosed:Connect(function()
print("Opt-in prompt closed")
end)