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_READY
NSString* const KONGREGATE_EVENT_USER_CHANGED
NSString* const KONGREGATE_EVENT_GAME_AUTH_CHANGED
NSString* const KONGREGATE_EVENT_LOGIN_COMPLETE
NSString* const KONGREGATE_EVENT_OPENING
NSString* const KONGREGATE_EVENT_CLOSED
NSString* const KONGREGATE_EVENT_USER_INVENTORY
NSString* const KONGREGATE_EVENT_RECEIPT_VERIFICATION_COMPLETED
NSString* const KONGREGATE_EVENT_SWRVE_RESOURCES_UPDATED
NSString* 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 *))block
Parameters
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 *)apiKey
Parameters
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 *)settings
Parameters
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 *)settingsJSON
Parameters
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 *)settings
Parameters
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 *)instance
Return 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 *)launchOptions
Parameters
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 *)userInfo
Parameters
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 *)url
Parameters
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)selector
Parameters
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)block
Parameters
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 *)pollEvents
Return 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 *)pollEventBundles
Return Value
An array of pending KongEventBundle events
Declared In
KongregateAPI.h
– services
Retrieves the global KongServices object.
- (KongServices *)services
Return Value
The KongServices object
Declared In
KongregateAPI.h
– stats
Retrieves the global KongStats object.
- (KongStatServices *)stats
Return Value
The KongStats object
Declared In
KongregateAPI.h
– mobile
Retrieves the global KongMobile object.
- (KongMobile *)mobile
Return Value
The KongMobile object
Declared In
KongregateAPI.h
– mtx
Retrieves the global KongMtx object.
- (KongMtx *)mtx
Return Value
The KongMobile object
Declared In
KongregateAPI.h
– analytics
Retrieves the global KongAnalytics object.
- (KongAnalytics *)analytics
Return Value
The KongAnalytics object
Declared In
KongregateAPI.h