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。

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

~AndroidPlatformConfiguration

 ~AndroidPlatformConfiguration()

公共静态函数

DEFAULT_ON_LAUNCHED_WITH_SNAPSHOT

void DEFAULT_ON_LAUNCHED_WITH_SNAPSHOT(
  SnapshotMetadata snapshot
)

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

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