gpg::AndroidPlatformConfiguration

#include <android_platform_configuration.h>

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

摘要

构造函数和析构函数

AndroidPlatformConfiguration()
~AndroidPlatformConfiguration()

公共类型

IntentHandler typedef
std::function< void(jobject)>
(可选)如果您不想使用主 activity 来启动 Play 游戏界面,请设置 IntentHandler 函数。
OnLaunchedWithSnapshotCallback typedef
std::function< void(SnapshotMetadata)>
SetOnLaunchedWithSnapshot 搭配使用的回调类型。

公共函数

SetActivity(jobject android_app_activity)
您必须将其设置为在应用的整个生命周期内保持活跃状态的 Android Activity。
SetOnLaunchedWithSnapshot(OnLaunchedWithSnapshotCallback callback)
注册一个在通过选择快照从 Play 游戏目标应用启动应用时调用的回调。
SetOptionalIntentHandlerForUI(IntentHandler intent_handler)
(可选)如果您不想使用主 activity 来启动 Play 游戏界面,请设置 IntentHandler 函数。
SetOptionalViewForPopups(jobject android_view)
设置用作弹出式窗口内容视图的视图。
Valid() const
bool
如果所有必需值均已提供给 AndroidPlatformConfiguration,则返回 true。

公共静态函数

DEFAULT_ON_LAUNCHED_WITH_SNAPSHOT(SnapshotMetadata snapshot)
void
通过选择快照从 Play 游戏目标应用启动应用时调用的默认回调。

公共类型

IntentHandler

std::function< void(jobject)> IntentHandler

(可选)如果您不想使用主 activity 来启动 Play 游戏界面,请设置 IntentHandler 函数。

使用 startActivityForResult 提供一个可在任何时间点启动所提供的界面 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 也将用于启动界面,并且必须实现 Activity.onActivityResult()。将结果转发到 AndroidSupport::OnActivityResult。此函数在 android_support.h 中声明。

SetOnLaunchedWithSnapshot

AndroidPlatformConfiguration & SetOnLaunchedWithSnapshot(
  OnLaunchedWithSnapshotCallback callback
)

注册一个在通过选择快照从 Play 游戏目标应用启动应用时调用的回调。

SetOptionalIntentHandlerForUI

AndroidPlatformConfiguration & SetOptionalIntentHandlerForUI(
  IntentHandler intent_handler
)

(可选)如果您不想使用主 activity 来启动 Play 游戏界面,请设置 IntentHandler 函数。

使用 startActivityForResult 提供一个可在任何时间点启动所提供的界面 intent 的函数。

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

SetOptionalViewForPopups

AndroidPlatformConfiguration & SetOptionalViewForPopups(
  jobject android_view
)

设置用作弹出式窗口内容视图的视图。

有效

bool Valid() const 

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

在本例中,唯一需要的值是“活动”。

~AndroidPlatformConfiguration

 ~AndroidPlatformConfiguration()

公共静态函数

DEFAULT_ON_LAUNCHED_WITH_SNAPSHOT

void DEFAULT_ON_LAUNCHED_WITH_SNAPSHOT(
  SnapshotMetadata snapshot
)

通过选择快照从 Play 游戏目标应用启动应用时调用的默认回调。

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