Kongregate Mobile Unity API
|
The global Kongregate API object, which is the main interface for interacting with the API. More...
Public Member Functions | |
delegate void | EventDelegate (string eventName, string eventJson) |
Delegate to receive API events. More... | |
bool | IsReady () |
Determines if the API is ready. More... | |
void | OnResume () |
Call this when the application is pausing, for example from. More... | |
void | LogDebug (string message) |
Log a debug message. | |
void | LogWarn (string message) |
Log a warning message. | |
void | SetEventListener (string gameObjectName, string functionName) |
void | SetEventBundleListener (GameObject gameObject, KongregateAPI.EventDelegate callback) |
Set an event listener to process Kongregate events. More... | |
void | MessageReceived (string eventName) |
This function should be called after processing an event, for example at the bottom of your event listener. More... | |
Static Public Member Functions | |
static KongregateAPI | Initialize (long gameId, string apiKey, KongregateAPI.EventDelegate callback=null, GameObject gameObject=null) |
Initializes the API. More... | |
static KongregateAPI | Initialize (GameObject gameObject) |
Initialize the API for Analytics Only. More... | |
static KongregateAPI | GetAPI () |
Retrieves the global API instance. More... | |
Public Attributes | |
const string | KONGREGATE_EVENT_READY = "KONG_API_EVENT_READY" |
Broadcast when the API is initialized and ready to use. | |
const string | KONGREGATE_EVENT_USER_CHANGED = "KONG_API_EVENT_USER_CHANGED" |
Broadcast when the user has changed. | |
const string | KONGREGATE_EVENT_GAME_AUTH_CHANGED = "KONG_API_EVENT_GAME_AUTH_TOKEN_CHANGED" |
Broadcast when the user's game authentication token has changed. | |
const string | KONGREGATE_EVENT_LOGIN_COMPLETE = "KONG_API_EVENT_LOGIN_COMPLETE" |
Broadcasts when the user has completed logging in on the panel. | |
const string | KONGREGATE_EVENT_OPENING = "KONG_API_EVENT_OPENING_KONGREGATE" |
Broadcast when the Kongregate panel is about to be opened. | |
const string | KONGREGATE_EVENT_CLOSED = "KONG_API_EVENT_CLOSED_KONGREGATE" |
Broadcast when the Kongregate panel has closed. | |
const string | KONGREGATE_EVENT_USER_INVENTORY = "KONG_API_EVENT_USER_INVENTORY" |
Broadcast when the user's inventory is received. | |
const string | KONGREGATE_EVENT_SERVICE_UNAVAILABLE = "KONG_API_EVENT_SERVICE_UNAVAILABLE" |
Broadcast when Kongregate is unavailable. More... | |
const string | KONGREGATE_EVENT_RECEIPT_VERIFICATION_COMPLETE = "KONG_API_EVENT_RECEIPT_VERIFICATION_COMPLETED" |
Broadcast when a receipt verification has completed. | |
const string | KONGREGATE_EVENT_SWRVE_RESOURCES_UPDATES = "KONG_API_EVENT_SWRVE_RESOURCES_UPDATED" |
Broadcast when the Swrve resources have been updated. | |
const string | KONGREGATE_EVENT_NOTIFICATION_COUNT_UPDATED = "KONG_API_EVENT_NOTIFICATION_COUNT_UPDATED" |
Broadcast when the notification count for the current user changes. | |
const string | KONG_API_EVENT_CHARACTER_TOKEN_REQUEST = "KONG_API_EVENT_CHARACTER_TOKEN_REQUEST" |
Broadcast when the API needs a new character token for guild chat authentication. More... | |
const string | CHARACTER_TOKEN_REQUEST = KONG_API_EVENT_CHARACTER_TOKEN_REQUEST |
const string | KONGREGATE_EVENT_OPEN_DEEP_LINK = "KONG_API_EVENT_OPEN_DEEP_LINK" |
Broadcast when the app is opened or brought to the foreground via deep link. | |
const string | KONGREGATE_EVENT_PROMO_AWARD = "KONG_API_EVENT_PROMO_AWARD" |
Broadcast when a promo item or currency should be awarded Parse the JSON in the event bundle to determine the award. More... | |
const string | KONGREGATE_EVENT_STEAM_AUTH_START = "KONG_API_EVENT_STEAM_AUTH_START" |
Steam only event fired when the Kongregate Steam authentication process starts. More... | |
const string | KONGREGATE_EVENT_STEAM_AUTH_COMPLETE = "KONGREGATE_EVENT_STEAM_AUTH_COMPLETE" |
Steam only event fired when the Kongregate Steam authentication process is complete. More... | |
const string | KONGREGATE_EVENT_STEAM_AUTH_ERROR = "KONG_API_EVENT_STEAM_AUTH_ERROR" |
Event fired if there was an error in the Kongregate Steam authentication process. More... | |
const string | KONGREGATE_PARAM_PROMO_ID = "promoId" |
KONGREGATE_EVENT_PROMO_AWARD event parameter for the promoID. | |
const string | KONGREGATE_PARAM_ITEM = "item" |
KONGREGATE_EVENT_PROMO_AWARD event parameter for the item to award. | |
const string | KONGREGATE_PARAM_CURRENCY = "currency" |
KONGREGATE_EVENT_PROMO_AWARD event parameter for the currency type to award. | |
const string | KONGREGATE_PARAM_AMOUNT = "amount" |
KONGREGATE_EVENT_PROMO_AWARD event parameter for the amount of currency to award. | |
const string | KONGREGATE_PARAM_INSTALL_URL = "installUrl" |
KONGREGATE_EVENT_PROMO_AWARD event parameter for a link to open after giving an award. | |
const string | RECEIPT_VERIFICATION_STATUS_UNKNOWN = "UNKNOWN" |
The transaction id status requested is unknown, it has possibly not been requested yet. | |
const string | RECEIPT_VERIFICATION_STATUS_PROCESSING = "PROCESSING" |
The transaction is still in the verification process. | |
const string | RECEIPT_VERIFICATION_STATUS_VALID = "VALID" |
The transaction is valid. | |
const string | RECEIPT_VERIFICATION_STATUS_INVALID = "INVALID" |
The transaction is invalid. | |
const string | AUTO_ANALYTICS_MODE_ENABLE_ALL = "ENABLE_ALL" |
This setting is the default. More... | |
const string | AUTO_ANALYTICS_MODE_DISABLE_ALL = "DISABLE_ALL" |
This setting will disable all automatic event and properties tracking. | |
const string | AUTO_ANALYTICS_MODE_CLOUD = "CLOUD" |
This is a special setting for games with server logic. More... | |
const string | ORIENTATION_PORTRAIT = "portrait" |
Options for locking the Kongregate panel to an orientation. More... | |
const string | KONGREGATE_OPTION_DOMAIN = "domain" |
Option to change the back-end domain, Type: String, default: "m.kongregate.com". | |
const string | KONGREGATE_OPTION_DEBUG = "debug" |
Option to control debugging/verbose logging type: Boolean, default: Boolean.FALSE. | |
const string | KONGREGATE_OPTION_DEBUG_WEBVIEW = "debug_webview" |
Option to control KitKat WebView debugging type: Boolean, default Boolean.FALSE. | |
const string | KONGREGATE_OPTION_MANAGE_LIFECYCLE = "manage_lifecycle" |
Option to control automatic onPause/onResume calls for API >= 14 type: Boolean, default Boolean.TRUE. | |
const string | KONGREGATE_OPTION_SHOW_SYSTEM_UI = "show_system_ui" |
Option to show the system UI when the kongregate panel is up. More... | |
const string | KONGREGATE_OPTION_ALLOW_IMMERSIVE_MODE = "allow_immersive_mode" |
Option to disable immersive mode on Android 4.4+ devices. More... | |
const string | KONGREGATE_OPTION_KEEN_PROJECT_ID = "keen_product_id" |
Keen options are included for legacy games. More... | |
const string | KONGREGATE_OPTION_KEEN_WRITE_KEY = "keen_write_key" |
Keen options are included for legacy games. More... | |
const string | KONGREGATE_OPTION_ANALYTICS_MODE = "auto_analytics_mode" |
Option indicating the game logic and players exist on a game server. | |
const string | KONGREGATE_OPTION_DEFER_ANALYTICS = "defer_analytics" |
Option to defer initialization of the Analytics class. More... | |
const string | KONGREGATE_OPTION_PERSISTENT_WEBVIEW = "persistent_webview" |
Enables a persistent WebView rather than creating new WebView instances. More... | |
const string | KONGREGATE_OPTION_GUILD_CHAT = "guild_chat" |
Enables guild chat functionality if also enabled on the server. More... | |
const string | KONGREGATE_OPTION_AUTO_ANALYTICS_FILTER = "auto_analytics_filter" |
Option to filter properties or events. More... | |
const string | KONGREGATE_OPTION_ADX_ENABLED = "adx_enabled" |
AD-X is no longer included with the SDK. | |
const string | KONGREGATE_OPTION_ADX_UPGRADE = "adx_upgrade" |
AD-X is no longer included with the SDK. | |
const string | KONGREGATE_OPTION_SWRVE_APP_ID = "swrve_app_id" |
Option to specify the SWRVE APP ID. | |
const string | KONGREGATE_OPTION_SWRVE_API_KEY = "swrve_api_key" |
Option to specify the SWRVE API Key. | |
const string | KONGREGATE_OPTION_KONG_ANALYTICS_ID = "kong_analytics_id" |
Option to specify the Kongregate Analytics App Id. | |
const string | KONGREGATE_OPTION_KONG_ANALYTICS_KEY = "kong_analytics_key" |
Option to specify the Kongregate API Key. | |
const string | KONGREGATE_OPTION_PANEL_ORIENTATION_OVERRIDE = "panel_orientation_override" |
Option to override default panel orientation mode ("sensor"). | |
const string | KONGREGATE_OPTION_CRASHLYTICS_LOGGING = "crashlytics_logging" |
Option to have the Kongregate SDK log to Crashlytics logging API. More... | |
const string | KONGREGATE_OPTION_CRASHLYTICS_USER_KEYS = "crashlytics_user_keys" |
Option to have the Kongregate SDK use the Crashlytics user keys API. More... | |
const string | KONGREGATE_OPTION_STRICT_LIFECYCLE_MODE = "strict_lifecycle" |
Option to enable strict lifecyle tracking. More... | |
const string | KONGREGATE_OPTION_ENABLED = "enabled" |
Option to disable the Kongregate plugin. | |
const string | KONGREGATE_OPTION_ADX_CLIENT_ID = "adx_client_id" |
const string | KONGREGATE_OPTION_ADX_ID = "adx_id" |
const string | KONGREGATE_OPTION_ADX_QA_UNTIL = "adx_qa_until" |
const string | KONGREGATE_OPTION_APPLE_ID = "apple_id" |
const string | KONGREGATE_OPTION_UNITY_PANEL_PAUSE_APP = "unity_panel_pause_app" |
Pause the Unity app when the kongregate panel is open. | |
const string | KONGREGATE_OPTION_UNITY_PANEL_PAUSE_SOUND = "unity_panel_pause_sound" |
Pause sound when Kongregate panel is open. | |
const string | KONGREGATE_OPTION_AUTO_REPOSITION = "auto_reposition" |
Auto position the Kongregate button when native button rendering is used. | |
const string | KONGREGATE_OPTION_UNITY_WEB_ENABLED = "unity_web_enabled" |
Enable WebPlayer/WebGL Kongregate plugin functionality for web builds. | |
const string | KONGREGATE_OPTION_SUPPORTED_PANEL_EVENTS = "supported_panel_events" |
Provide a list of panel events your game supports. More... | |
const string | KONGREGATE_OPTION_DEFAULT_PANEL_TRANSITION = "default_panel_transition" |
Specify default panel transition to use when the panel is open. More... | |
const string | KONGREGATE_OPTION_UNITY_STANDALONE_ENABLED = "unity_standalone_enabled" |
Enable WebPlayer/WebGL Kongregate plugin functionality for web builds. | |
const string | KONGREGATE_OPTION_CUSTOM_PLAYER_ID = "custom_player_id" |
Specifies the Player ID to be sent with every event. More... | |
const string | KONGREGATE_OPTION_DEFER_GDPR_ALERT = "defer_gdpr_check" |
Option to defer the GDPR alert dialog until MobileServices#GDPR_ALERT_TRIGGER is triggered (MobileServices#trigger(String) (String)}) More... | |
const string | KONGREGATE_OPTION_TEST_GDPR_ALERT = "test.gdpr_alert" |
Set this flag to force the GDPR dialog to always show every time it's checked. More... | |
const string | KONGREGATE_OPTION_DELTA_ENVIRONMENT_KEY = "delta_env_key" |
Option to specify the DELTA DNA ENVIRONMENT KEY. | |
const string | KONGREGATE_OPTION_DELTA_COLLECT_URL = "delta_collect_url" |
Option to specify the DELTA DNA COLLECT URL. | |
const string | KONGREGATE_OPTION_DELTA_ENGAGE_URL = "delta_engage_url" |
Option to specify the DELTA DNA ENGAGE URL. | |
const string | KONGREGATE_OPTION_AUTO_COLLECT_TOKEN = "auto_collect_token" |
Option to enable/disable collection of push token. | |
const string | KONGREGATE_SWRVE_PREFIX = "swrve." |
SWRVE Options. | |
const string | KONGREGATE_SWRVE_AUTO_COLLECT_DEVICE_TOKEN = "swrve.autoCollectDeviceToken" |
Swrve iOS only options. | |
const string | ADJUST_SALE = "sale" |
Adjust Events. | |
const string | VERSION = Kongregate.Version.SDK_VERSION |
Current version of the SDK. | |
Properties | |
IMobile | Mobile [get] |
Reference to the Kongregate::IMobile interface. | |
IServices | Services [get] |
Reference to the Kongregate::IServices interface. | |
IStats | Stats [get] |
Reference to the Kongregate::IStats interface. | |
IAnalytics | Analytics [get] |
Reference to the Kongregate::IAnalytics interface. | |
IMtx | Mtx [get] |
Reference to the Kongregate::IMtx interface. | |
long | GameID [get] |
The global Kongregate API object, which is the main interface for interacting with the API.
delegate void KongregateAPI.EventDelegate | ( | string | eventName, |
string | eventJson | ||
) |
Delegate to receive API events.
eventName | The name of the event, a constant from KongregateAPI |
eventJson | The JSON data payload for the event or null if no data is included with the event. |
|
inlinestatic |
Retrieves the global API instance.
Must not be called until after initialize.
|
inlinestatic |
Initializes the API.
gameId | Your game id |
apiKey | Your mobile API key |
gameObject | the game object hosting the Kongregate API |
|
inlinestatic |
Initialize the API for Analytics Only.
Kongregate authentication and panel will not be supported.
gameObject | the game object hosting the Kongregate API |
|
inline |
Determines if the API is ready.
|
inline |
This function should be called after processing an event, for example at the bottom of your event listener.
eventName | The event name |
|
inline |
Call this when the application is pausing, for example from.
|
inline |
Set an event listener to process Kongregate events.
This new version of event listener will receive a JSON payload along with the event. The old version still works but will only receive the event name. You may only set one Event Listener.
gameObject | An active, persistent Game Object. |
callback | The delegate to receive events. The format is (string eventName, string eventJSON) |
|
inline |
The target function should take a single String
argument.
gameObjectName | The Unity game object name |
functionName | The function to call |
const string KongregateAPI.AUTO_ANALYTICS_MODE_CLOUD = "CLOUD" |
This is a special setting for games with server logic.
Set this if your game will track player_creations events and the player_id field.
const string KongregateAPI.AUTO_ANALYTICS_MODE_ENABLE_ALL = "ENABLE_ALL" |
This setting is the default.
The SDK will track the full suite of automatic events and fields.
const string KongregateAPI.CHARACTER_TOKEN_REQUEST = KONG_API_EVENT_CHARACTER_TOKEN_REQUEST |
const string KongregateAPI.KONG_API_EVENT_CHARACTER_TOKEN_REQUEST = "KONG_API_EVENT_CHARACTER_TOKEN_REQUEST" |
Broadcast when the API needs a new character token for guild chat authentication.
This generally happens when a previously valid character token expires. If you receive this event repeatedly after generating a new token you may need to double check your JWT implementation and ensure you are using the proper server API key to sign the token.
const string KongregateAPI.KONGREGATE_EVENT_PROMO_AWARD = "KONG_API_EVENT_PROMO_AWARD" |
Broadcast when a promo item or currency should be awarded Parse the JSON in the event bundle to determine the award.
The format of the JSON bundle will be: { "promoId": "promo_ebf", "item": "super_punch", "currency": "gold", "amount": 100 }
Once the award is complete, invoke Kongregate::IAnalytics#FinishPromoAward(string) which will set a Swrve User Property that may be used to prevent the promo from appearing again
const string KongregateAPI.KONGREGATE_EVENT_SERVICE_UNAVAILABLE = "KONG_API_EVENT_SERVICE_UNAVAILABLE" |
Broadcast when Kongregate is unavailable.
This may be due to network connectivity or Kongregate may be down for maintence.
const string KongregateAPI.KONGREGATE_EVENT_STEAM_AUTH_COMPLETE = "KONGREGATE_EVENT_STEAM_AUTH_COMPLETE" |
Steam only event fired when the Kongregate Steam authentication process is complete.
When this event is fired, the current Kongregate User has been verified to be linked with the current Steam ID.
In general, most games only need to listen for the GAME_AUTH_CHANGED event. However, if you wish to keep the Kongregate User's active Steam ID link in sync, you may listen for this event and check for any changes.
const string KongregateAPI.KONGREGATE_EVENT_STEAM_AUTH_ERROR = "KONG_API_EVENT_STEAM_AUTH_ERROR" |
Event fired if there was an error in the Kongregate Steam authentication process.
In general, there is not much to do in response to this event. It simply signifies something went wrong with the process, most likely a loss of connection.
As with the other STEAM events, most games may ignore this event. If you were waiting for the STEAM_AUTH_COMPLETE event to revalidate the current Steam user is linked with the current Kongregate user, this event signifies the latest Kongregate Steam authentication attempt failed. You may continue to use the existing Kongregate User, if one exist.
const string KongregateAPI.KONGREGATE_EVENT_STEAM_AUTH_START = "KONG_API_EVENT_STEAM_AUTH_START" |
Steam only event fired when the Kongregate Steam authentication process starts.
This occurs when the Kongregate SDK is initialized. Since a Kongregate user may relink with a different Steam user while the game is in the background, it will also occur every time the game regains focus.
In general this event may be ignored. It's provided in case a more detailed view into the Kongregate Steam authentication flow is desired.
const string KongregateAPI.KONGREGATE_OPTION_ADX_CLIENT_ID = "adx_client_id" |
const string KongregateAPI.KONGREGATE_OPTION_ADX_ID = "adx_id" |
const string KongregateAPI.KONGREGATE_OPTION_ADX_QA_UNTIL = "adx_qa_until" |
const string KongregateAPI.KONGREGATE_OPTION_ALLOW_IMMERSIVE_MODE = "allow_immersive_mode" |
Option to disable immersive mode on Android 4.4+ devices.
By default, the SDK will attempt to enter immersive mode when it is initialized, or when the onResume method is called with a valid Activity. Type: Boolean, default: Boolean.TRUE
const string KongregateAPI.KONGREGATE_OPTION_APPLE_ID = "apple_id" |
const string KongregateAPI.KONGREGATE_OPTION_AUTO_ANALYTICS_FILTER = "auto_analytics_filter" |
Option to filter properties or events.
A comma delimeted list of field and event names.
const string KongregateAPI.KONGREGATE_OPTION_CRASHLYTICS_LOGGING = "crashlytics_logging" |
Option to have the Kongregate SDK log to Crashlytics logging API.
Crashlytics must be integrated to use this option. Default if false.
const string KongregateAPI.KONGREGATE_OPTION_CRASHLYTICS_USER_KEYS = "crashlytics_user_keys" |
Option to have the Kongregate SDK use the Crashlytics user keys API.
Crashlytics must be integrated to use this option. Default is false.
const string KongregateAPI.KONGREGATE_OPTION_CUSTOM_PLAYER_ID = "custom_player_id" |
Specifies the Player ID to be sent with every event.
This value will also be used for the SWRVE User ID. In general this value should not be specified. When not specified, the SDK will generate a UUID to use as the Player ID. For special cases, such as for QA builds, it is sometimes useful to use this option to manually set the Player ID/SWRVE User ID.
This option is only read when the app is first launched. The player ID can not change for a specific install, once it's been set.
This option has no effect if the KONGREGATE_OPTION_ANALYTICS_MODE is set to CLOUD_GAME.
const string KongregateAPI.KONGREGATE_OPTION_DEFAULT_PANEL_TRANSITION = "default_panel_transition" |
Specify default panel transition to use when the panel is open.
This will be used in the place of the OS's default animation. The list of supported custom panel tranitions may be found in Mobile ) (e.g. Kongregate::Mobile#PANEL_TRANSITION_SLIDE_FROM_LEFT)
const string KongregateAPI.KONGREGATE_OPTION_DEFER_ANALYTICS = "defer_analytics" |
Option to defer initialization of the Analytics class.
Use this if you need to collect data before sending initial events, or if you initialize the Kongregate API when your game is started via a Service, BroadcastReceiver, Alarm, etc.
If you use enable this flag, you should manually initialize the Analytics class when appropriate. For example, when your main Activity is created. You can initialize the Analytics system using Kongregate::IAnalytics#Start
Type: Boolean, default: Boolean.FALSE
const string KongregateAPI.KONGREGATE_OPTION_DEFER_GDPR_ALERT = "defer_gdpr_check" |
Option to defer the GDPR alert dialog until MobileServices#GDPR_ALERT_TRIGGER is triggered (MobileServices#trigger(String) (String)})
By default the GDPR Alert dialog will be shown as soon as the SDK detects the user needs to accept the privacy policy. This is typically shortly after the game is launched or returns to the foreground. Use this option to control the moment when the alert dialog may be shown.
const string KongregateAPI.KONGREGATE_OPTION_GUILD_CHAT = "guild_chat" |
Enables guild chat functionality if also enabled on the server.
This flag can be used for testing guild chat before rolling it out in a live release.
Type: Boolean, default: Boolean.FALSE
const string KongregateAPI.KONGREGATE_OPTION_KEEN_PROJECT_ID = "keen_product_id" |
Keen options are included for legacy games.
New games should use Swrve.
Option to set a Keen project ID. Used for tracking analytics. Must also specify KONGREGATE_OPTION_KEEN_WRITE_KEY
const string KongregateAPI.KONGREGATE_OPTION_KEEN_WRITE_KEY = "keen_write_key" |
Keen options are included for legacy games.
New games should use Swrve.
Option to set a Keen write key. To be used with KONGREGATE_OPTION_KEEN_PROJECT_ID
const string KongregateAPI.KONGREGATE_OPTION_PERSISTENT_WEBVIEW = "persistent_webview" |
Enables a persistent WebView rather than creating new WebView instances.
This makes memory usage more stable, and it is recommended you set this value to true for better panel performance. You should only disable this if you are running into problems.
Type: Boolean, default: Boolean.TRUE
const string KongregateAPI.KONGREGATE_OPTION_SHOW_SYSTEM_UI = "show_system_ui" |
Option to show the system UI when the kongregate panel is up.
See http://developer.android.com/reference/android/view/View.html#setSystemUiVisibility(int) Type: Boolean, default: Boolean.FALSE
const string KongregateAPI.KONGREGATE_OPTION_STRICT_LIFECYCLE_MODE = "strict_lifecycle" |
Option to enable strict lifecyle tracking.
When enabled, the Kongregate API must be initialized in your activity's onCreate() method and your onResume()/onPause() methods must invoke the corresponding SDK onResume()/onPause() methods. The default is off for convenience, since many development tools (i.e. Unity) do not provide direct access to activity lifecycle methods. This setting may need to be on for games with complex activity structures, in which multiple activities may be visible at the same time, for session tracking to work properly.
const string KongregateAPI.KONGREGATE_OPTION_SUPPORTED_PANEL_EVENTS = "supported_panel_events" |
Provide a list of panel events your game supports.
The panel may dynamically adjust it's UI based on the events your game supports. The list of panel events that may be fired can be found in Mobile (e.g. Kongregate::Mobile#PANEL_EVENT_GO_TO_GUILDS).
const string KongregateAPI.KONGREGATE_OPTION_TEST_GDPR_ALERT = "test.gdpr_alert" |
Set this flag to force the GDPR dialog to always show every time it's checked.
This option should only be used while testing your integration to verify the alert does not adversely affect your game. To control when the GDPR alert can appear, use KONGREGATE_OPTION_DEFER_GDPR_ALERT
Be sure to remove this option from production builds
const string KongregateAPI.ORIENTATION_PORTRAIT = "portrait" |
Options for locking the Kongregate panel to an orientation.
Default is to autorotate to all orientations.
|
get |