Disable hook detection
By default, the hook detection is always enabled in the release version of the Risk Management SDK.
The application can disable this feature or take the necessary action by implementing the GAHErrorListener interface, sending the implementation object to GAHCoreConfig, and sending the GAHCoreConfig object to initialize().
A runtime exception is thrown on detection of hooking on critical methods of the Risk Management SDK.
Android - Java
class GAHHookDetectionListener implements GAHErrorListener
{
private SharedPreferences mSharedPreference;
@Override
public Object SDKAbort() {
return false;
}
}
GAHCoreConfig coreConfig = new GAHCoreConfig.Builder(getApplicationContext(), URL)
.setSDKErrorListener(new GAHHookDetectionListener())
.build();
iOS - Objective C
hookDetectionListener.h
#import <Risk Management/Risk Management.h>
@interface hookDetectionListener : GAHErrorListener
@end
hookDetectionListener.m
#import "hookDetectionListener.h"
@implementation hookDetectionListener
-(BOOL)SDKAbort {
return NO;
}
@end
//add this in init, appdelegate
hookDetectionListener * _hookDetectionListener = [[hookDetectionListener alloc] init];
[reConfig setSDKErrorListener:_hookDetectionListener];
Swift
class hookDetectionListener: GAHErrorListener {
override func sdkAbort() -> Bool {
return false;
}
}
let hookDetectionListener = hookDetectionListener()
reConfig .setSDKErrorListener(hookDetectionListener)