KongregateAPI Class Reference
| Inherits from | NSObject |
|---|---|
| Declared in | KongregateAPI.h |
Overview
The global Kongregate API object, which is the main interface for interacting with the API. This header also contains constants for API Events:
NSString* const KONGREGATE_EVENT_READYNSString* const KONGREGATE_EVENT_USER_CHANGEDNSString* const KONGREGATE_EVENT_GAME_AUTH_CHANGEDNSString* const KONGREGATE_EVENT_LOGIN_COMPLETENSString* const KONGREGATE_EVENT_OPENINGNSString* const KONGREGATE_EVENT_CLOSEDNSString* const KONGREGATE_EVENT_USER_INVENTORYNSString* const KONGREGATE_EVENT_RECEIPT_VERIFICATION_COMPLETEDNSString* const KONGREGATE_EVENT_SWRVE_RESOURCES_UPDATEDNSString* const KONGREGATE_EVENT_SERVICE_UNAVAILABLE
+ setLogEcho:
Set a block to echo Kong Log messages to. Useful for crash reporting tools that upload console logs with reports
+ (void)setLogEcho:(void ( ^ ) ( NSString *))blockParameters
block |
the block to be invoked when the SDK logs a debug message |
|---|
Declared In
KongregateAPI.h
+ initialize:apiKey:
Initializes the API with the default settings.
+ (void)initialize:(int64_t)gameId apiKey:(NSString *)apiKeyParameters
gameId |
Your game id |
|---|---|
apiKey |
Your mobile API key |
Declared In
KongregateAPI.h
+ initialize:apiKey:withSettings:
Initializes the API with custom settings.
+ (void)initialize:(int64_t)gameId apiKey:(NSString *)apiKey withSettings:(NSDictionary *)settingsParameters
gameId |
Your game id |
|---|---|
apiKey |
Your mobile API key |
settings |
A dictionary with settings for controlling API behavior |
Declared In
KongregateAPI.h
+ initialize:apiKey:withSettingsJSON:
Initializes the API with custom JSON formatted settings.
+ (void)initialize:(int64_t)gameId apiKey:(NSString *)apiKey withSettingsJSON:(NSString *)settingsJSONParameters
gameId |
Your game id |
|---|---|
apiKey |
Your mobile API key |
settingsJSON |
A JSON formatted string with settings for controlling API behavior |
Declared In
KongregateAPI.h
+ initializeWithSettings:
Initialize the API to collect analytics only (no Kongregate panel or backend)
+ (void)initializeWithSettings:(NSDictionary *)settingsParameters
settings |
A dictionary with settings for controlling API behavior |
|---|
Declared In
KongregateAPI.h
+ instance
Retrieves the global API instance. Must not be called until after initialize.
+ (KongregateAPI *)instanceReturn Value
The global KongregateAPI object
Declared In
KongregateAPI.h
+ didFinishLaunchingWithOptions:
Call this from your AppDelegate when the application launches. This is used to track push notifications through swrve.
+ (void)didFinishLaunchingWithOptions:(NSDictionary *)launchOptionsParameters
launchOptions |
the launch options passed to your AppDelegate’s didFinishLaunchingWithOptions methodRe |
|---|
Declared In
KongregateAPI.h
+ didReceiveRemoteNotification:
Call this from your AppDelegate when a push notification is received. This is used for tracking push notifications through swrve.
+ (void)didReceiveRemoteNotification:(NSDictionary *)userInfoParameters
userInfo |
the userInfo passed to your AppDelegate’s didReceiveRemoteNotification |
|---|
Declared In
KongregateAPI.h
+ willOpenUrl:
Call this from your AppDelegate’s openUrl method which is invoked when the app is opened from a deep link. This is used for Adjust deep link reattributions.
+ (void)willOpenUrl:(NSURL *)urlParameters
url |
the deep link URL |
|---|
Discussion
It is OK invoke this method prior to initializing the Kongregate SDK.
Declared In
KongregateAPI.h
– setApiEventListener:selector:
Sets the listener function that will be notified of Kongregate events
- (void)setApiEventListener:(id)observer selector:(SEL)selectorParameters
observer |
The observer object |
|---|---|
selector |
The selector to call on the observer |
Declared In
KongregateAPI.h
– setApiEventBundleListener:
Sets the listener function that will be notified of Kongregate events. This differs from setApiEventListener in that the events may contain a JSON payload.
- (void)setApiEventBundleListener:(KongEventBundleListener)blockParameters
block |
a ^(NSString eventName, NSString eventJSON) block to be invoked on Kongregate events |
|---|
Declared In
KongregateAPI.h
– pollEvents
For environments where it isn’t possible to set a listener object, you can use this method to poll for an array of pending events and iterate through them
- (NSArray *)pollEventsReturn Value
An array of NSString pending events
Declared In
KongregateAPI.h
– pollEventBundles
For environments where it isn’t possible to set a listener object, you can use this method to poll for an array of pending events and iterate through them
- (NSArray *)pollEventBundlesReturn Value
An array of pending KongEventBundle events
Declared In
KongregateAPI.h
– services
Retrieves the global KongServices object.
- (KongServices *)servicesReturn Value
The KongServices object
Declared In
KongregateAPI.h
– stats
Retrieves the global KongStats object.
- (KongStatServices *)statsReturn Value
The KongStats object
Declared In
KongregateAPI.h
– mobile
Retrieves the global KongMobile object.
- (KongMobile *)mobileReturn Value
The KongMobile object
Declared In
KongregateAPI.h
– mtx
Retrieves the global KongMtx object.
- (KongMtx *)mtxReturn Value
The KongMobile object
Declared In
KongregateAPI.h
– analytics
Retrieves the global KongAnalytics object.
- (KongAnalytics *)analyticsReturn Value
The KongAnalytics object
Declared In
KongregateAPI.h