API to Start Library UI
Use the API for respective platforms to launch the Quantum Visualizer Library from the Native app. This feature is available from V8 SP3 onwards. The Start Library API is available for Android, iOS, and Windows platforms.
NOTE: Calling this API from the Native app will internally call the appService callback of the Quantum Visualizer Application.
Android
You must use this API to launch the library UI. This API must be called after the library is successfully initialized.
NOTE: You must call the Initialize Library API before using the Start Library API; otherwise, this method throws an exception.
NOTE: Avoid passing null to mandatory parameters as that results in an exception.
Package
com.kony.library
Class
KonyLibrary
Syntax
public static void start(String libraryId,
android.app.Activity activity,
Hashtable<String,Object> libraryArgs,
Hashtable<String,Object> libraryConfig,
KonyLibrary.OnLibraryResultListener resultListener)throws Exception
Input Parameters
Parameter | Description |
---|---|
libraryId | Specify the name of the library (Quantum Visualizer Application AppID) that needs to be launched. This parameter cannot be null. |
activity | Specify the Native app activity that is used to start the main activity of the Quantum Visualizer Library. This parameter cannot be null. |
libraryArgs |
This parameter (key-value pair with supported values as primitive data types such as int, float, double, boolean, and String) is used to pass the native app's data to the library (based on the contract of the library). NOTE: libraryArgs are passed to the Quantum Visualizer Application's appService callback in new launch mode, which is known as library mode (whose constant is kony.application.APP_LAUNCH_MODE_LIBRARY). |
libraryConfig |
The parameter that is used to configure the library. NOTE: The libraryConfig parameter is currently ignored. You can pass null for this parameter. |
resultListener |
Register a callback to send an acknowledgment (result) from Quantum Visualizer Library to the Native app. This parameter cannot be null. NOTE: The resultListener methods are called from the main/UI thread. |
Example
try { KonyLibrary.start( < libraryId > , < activity > , < libraryArgs > , null, < resultListener > ); } catch (Exception ex) {}
OnLibraryResultListener Interface
Package
com.kony.library
Class
KonyLibrary
Syntax
public static interface OnLibraryResultListener
Methods
onLibraryResult
abstract void onLibraryResult(String libraryId, Hashtable<String,Object> resultData)
Parameters
Parameter | Description |
---|---|
libraryId |
Specifies the library for which the acknowledgment (result) is sent. |
resultData |
Specifies the result data in the form of key-value pairs. NOTE: The library should publish the keys of resultData to let the Native app handle the resultData. |
iOS
You must use this API to launch the library UI. This API must be called after the library is successfully initialized.
NOTE: You must call the Initialize Library API before using the Start Library API; otherwise, this method throws an exception.
NOTE: Avoid passing null to mandatory parameters as that results in an exception.
Import
<CoreComponent/KonyLibrary.h>
Class
KonyLibrary
Method
+ start : viewController: libraryArgs : libraryConfig: delegate:
Declaration
+ (void) start:(NSString *)libraryId
viewController:(UIViewController*) viewController
libraryArgs:(NSDictionary*) libraryArgs
libraryConfig:(NSDictionary*) libraryConfig
delegate:(id<KonyLibraryResultDelegate>) resultDelegate
Input Parameters
Parameter | Description |
---|---|
libraryId | Specify the name of the library (Quantum Visualizer Application AppID) that needs to be launched. This parameter cannot be null. |
viewController | Specify the Native app's viewController reference to push the main UI controller into the library. |
libraryArgs |
This parameter (key-value pair with supported values as primitive data types such as int, float, double, boolean, and String) is used to pass the native app's data to the library (based on the contract of the library). NOTE: libraryArgs are passed to the Quantum Visualizer Application's appService callback in new launch mode, which is known as library mode (whose constant is kony.application.APP_LAUNCH_MODE_LIBRARY). |
libraryConfig |
The parameter that is used to configure the launch of the library. NOTE: The libraryConfig parameter is currently ignored. |
resultDelegate |
Register a delegate (that conforms to KonyLibraryResultDelegate) to send an acknowledgment (result) from Quantum Visualizer Library to the Native app. This parameter cannot be null. NOTE: The resultListener methods are called from the main/ UI thread. |
[KonyLibrary start:<libraryId> viewController:<viewController> libraryArgs:<libraryArgs>
libraryConfig:<libraryConfig> delegate:<resultDelegate>];
Protocol : KonyLibraryResultDelegate
Import
<CoreComponent/KonyLibrary.h>
Class
KonyLibrary
Method
(void)onLibraryResult: resultData:
Declaration
(void) onLibraryResult: (NSString * ) libraryId resultData: (NSDictionary * ) resultData
Parameters
Parameter | Description |
---|---|
libraryId |
Specifies the library for which the acknowledgment (result) is sent. |
resultData |
Specifies the result data in the form of key-value pairs. NOTE: The library should publish the keys of resultData to let the Native app handle the resultData. |
Windows
You must use this API to launch the library UI. This API must be called after the library is successfully initialized.
NOTE: You must call the Initialize Library API before using the Start Library API; otherwise, this method throws an exception.
NOTE: Avoid passing null to mandatory parameters as that results in an exception.
Package
Framework
Class
KonyLibrary
Syntax
public static void Start(string libraryId, Dictionary<string, Object> libraryArgs, Dictionary<string, Object> libraryConfig, ILibraryResultListener resultListener)
Parameters
Parameter | Description |
---|---|
libraryId | Specify the name of the library (Quantum Visualizer Application AppID) that needs to be launched. This parameter cannot be null. |
libraryArgs |
This parameter (key-value pair with supported values as primitive data types such as int, float, double, boolean, and String) is used to pass the native app's data to the library (based on the contract of the library). NOTE: libraryArgs are passed to the Quantum Visualizer Application's appService callback in new launch mode, which is known as library mode (whose constant is kony.application.APP_LAUNCH_MODE_LIBRARY). |
libraryConfig |
The parameter that is used to configure the launch of the library. NOTE: The libraryConfig parameter is currently ignored. |
resultListener | Register a callback to send the acknowledgment (result) from Quantum Visualizer Library to the Native app. This parameter cannot be null. |
NOTE: The resultListener methods are called from the main/ UI thread.
ILibraryResultListener Interface
Package
Framework
Syntax
public interface ILibraryResultListener
Methods
OnLibraryResult
void OnLibraryResult(String libraryId, Dictionary <string, Object> resultData)
Parameters
Parameter | Description |
---|---|
libraryId | Specifies the library for which the acknowledgment (result) is sent. |
resultData | Specifies the result data in the form of key-value pairs. NOTE: The library should publish the keys of resultData to let the Native app handle the resultData. |