Nuclei Callback
NucleiCallback
NucleiCallback is used to take care of the core functionalities of the Nuclei SDK.
Implement NucleiCallback
interface in the application class.
Please refer to the below code (The use case is mentioned above each method in comments):
class Application extends MultiDexApplication implements NucleiCallback {
private NucleiSDK nucleiSDK;
@Override
public void onCreate() {
super.onCreate();
initNuclei();
}
public NucleiSDK getNucleiSDK() {
return nucleiSDK;
}
private void initNuclei() {
nucleiSDK = NucleiSDK.bind(this)
….
….
.init();
nucleiSDK.setNucleiCallback(this);
}
/**
* This will be called before any call for starting Nuclei
*
* @return true if user is logged in into the bank app, else false
*/
@Override
public boolean isParentAppLoggedIn() {
// Implement the logic to check if user is logged in into the bank app.
boolean isParentAppLoggedIn = true;
return isParentAppLoggedIn;
}
/**
* This method handles the click on the menu items set in setMenuList() method
*
* @param menuIndex is the index of the menu item selected
*/
@Override
public void onNucleiOptionsItemSelected(int menuIndex) {
switch (menuIndex) {
case 0:
// Handle menu item 1 selection;
break;
default:
//do nothing
}
}
/**
* This method is called when user exit the Nuclei SDK
* Call to this method can be used to show appropriate screen
*/
@Override
public void onNucleiSDKExit() {
}
/**
* This method is used to initialize default notification icon
* @return drawable png icon
* It must not be a minmap or vector drawable
*/
@Override
public int getDefaultNotificationIcon() {
return R.drawable.ic_notification_icon_big;
}
/**
* This method is used to initialize small notification icon
* @return drawable png icon
* It must not be a minmap or vector drawable
*/
@Override
public int getSmallNotificationIcon() {
return R.drawable.ic_notification_icon_small;
}
@Override
public void onHomeOptionClicked() {
}
/**
* With every user action in sdk, this method will be called
* Every time you get a call on this method means the user is active in the Nuclei screen.
* In that case you need to refresh the user session.
* 3. If this is not handled and user experiences session timeout in the bank app while
* doing a transaction on Nuclei screen, it will result in transaction drop
*/
@Override
public void onNucleiHeartBeat() {
}
}