gpg::AndroidPlatformConfiguration

#include <android_platform_configuration.h>

在 Android 上创建 GameServices 类的实例时使用的平台配置。

摘要

构造函数与析构函数

AndroidPlatformConfiguration()
~AndroidPlatformConfiguration()

公共类型

IntentHandler typedef
std::function< void(jobject)>
如果你不想使用主 Activity 来启动 Play Games UI,可以选择设置 IntentHandler 函数。
OnLaunchedWithSnapshotCallback typedef
std::function< void(SnapshotMetadata)>
SetOnLaunchedWithSnapshot 一起使用的回调类型。

公共函数

SetActivity(jobject android_app_activity)
你必须将其设置为在应用生命周期内保持活跃的 Android Activity。
SetOnLaunchedWithSnapshot(OnLaunchedWithSnapshotCallback callback)
注册一个回调,如果应用是从 Play Games Destination 应用通过选择快照启动的,则会调用此回调。
SetOptionalIntentHandlerForUI(IntentHandler intent_handler)
如果你不想使用主 Activity 来启动 Play Games UI,可以选择设置 IntentHandler 函数。
SetOptionalViewForPopups(jobject android_view)
设置用作弹窗内容视图的 View。
Valid() const
bool
如果所有必需的值都已提供给 AndroidPlatformConfiguration,则返回 true。

公共静态函数

DEFAULT_ON_LAUNCHED_WITH_SNAPSHOT(SnapshotMetadata snapshot)
void
当应用从 Play Games Destination 应用通过选择快照启动时调用的默认回调。

公共类型

IntentHandler

std::function< void(jobject)> IntentHandler

如果你不想使用主 Activity 来启动 Play Games UI,可以选择设置 IntentHandler 函数。

提供一个可以在任何时候使用 startActivityForResult 启动提供的 UI Intent 的函数。

用于启动此 Intent 的 Activity 必须实现 Activity.onActivityResult()。将结果转发到 AndroidSupport::OnActivityResult。此函数在 android_support.h 中声明。

OnLaunchedWithSnapshotCallback

std::function< void(SnapshotMetadata)> OnLaunchedWithSnapshotCallback

SetOnLaunchedWithSnapshot 一起使用的回调类型。

公共函数

AndroidPlatformConfiguration

 AndroidPlatformConfiguration()

SetActivity

AndroidPlatformConfiguration & SetActivity(
  jobject android_app_activity
)

你必须将其设置为在应用生命周期内保持活跃的 Android Activity。

如果你没有为 SetOptionalIntentHandlerForUI 设置任何内容,则此 activity 也将用于启动 UI,并且必须实现 Activity.onActivityResult()。将结果转发到 AndroidSupport::OnActivityResult。此函数在 android_support.h 中声明。

SetOnLaunchedWithSnapshot

AndroidPlatformConfiguration & SetOnLaunchedWithSnapshot(
  OnLaunchedWithSnapshotCallback callback
)

注册一个回调,如果应用是从 Play Games Destination 应用通过选择快照启动的,则会调用此回调。

SetOptionalIntentHandlerForUI

AndroidPlatformConfiguration & SetOptionalIntentHandlerForUI(
  IntentHandler intent_handler
)

如果你不想使用主 Activity 来启动 Play Games UI,可以选择设置 IntentHandler 函数。

提供一个可以在任何时候使用 startActivityForResult 启动提供的 UI Intent 的函数。

用于启动此 Intent 的 Activity 必须实现 Activity.onActivityResult()。将结果转发到 AndroidSupport::OnActivityResult。此函数在 android_support.h 中声明。

SetOptionalViewForPopups

AndroidPlatformConfiguration & SetOptionalViewForPopups(
  jobject android_view
)

设置用作弹窗内容视图的 View。

Valid

bool Valid() const 

如果所有必需的值都已提供给 AndroidPlatformConfiguration,则返回 true。

在这种情况下,唯一必需的值是 Activity。

~AndroidPlatformConfiguration

 ~AndroidPlatformConfiguration()

公共静态函数

DEFAULT_ON_LAUNCHED_WITH_SNAPSHOT

void DEFAULT_ON_LAUNCHED_WITH_SNAPSHOT(
  SnapshotMetadata snapshot
)

当应用从 Play Games Destination 应用通过选择快照启动时调用的默认回调。

这可以通过使用 SetOnLaunchedWithSnapshot 设置新的回调来覆盖。