ExperienceNotificationService

非推奨を表示

*このコンテンツは、ベータ版のAI(人工知能)を使用して翻訳されており、エラーが含まれている可能性があります。このページを英語で表示するには、 こちら をクリックしてください。

作成できません
サービス
複製されていません

エクスペリエンス通知 は、13以上のユーザーが、タイムリーでパーソナライズされた通知で、お気に入りのエクスペリエンスについて最新情報を取得できる方法です。このサービスには、ユーザーを検証し、通知を有効にするよう求める方法が含まれています。

概要

方法

  • ローカルプレイヤーに通知を有効にするための体験中のプロンプを表示します。

  • ローカルプレイヤーが通知を有効にするように求められるかどうかを示します。

イベント

プロパティ

方法

PromptOptIn

()

戻り値

()

コードサンプル

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

イールド

戻り値

コードサンプル

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


コードサンプル

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)