Setup Leap Callbacks
Whenever end-user interacts with flows or elements events are generated to track the insights. To listen to Leap callbacks, Follow the below steps to do the same.
Listen to all the events in your Application(android) / AppDelegate(iOS) class.
Android
React Native
iOS Swift
iOS Objective-C
1
import is.leap.android.LeapEventListener;
2
3
public class MyApplication extends Application {
4
5
@Override
6
public void onCreate() {
7
LeapEventCallbacks eventListener = new LeapEventCallbacks() {
8
@Override
9
public void onEvent(Map<String, String> eventData) {
10
11
}
12
};
13
Leap.setLeapEventCallbacks(eventListener);
14
}
15
}
Copied!
1
import { DeviceEventEmitter } from 'react-native';
2
3
export class App extends React.Component {
4
componentDidMount() {
5
// Listen for callbacks
6
const onLeapCallback = (event) => {
7
console.log("Leap Events: ", event)
8
};
9
10
DeviceEventEmitter.addListener('LeapCallbacks', onLeapCallback);
11
}
12
}
Copied!
1
Leap.shared.callback = self
2
3
4
extension AppDelegate:LeapCallback {
5
func eventNotification(eventInfo: Dictionary<String, Any>) {
6
7
}
8
}
Copied!
1
@interface AppDelegate () <LeapCallback>
2
3
Leap.shared.callback = self;
4
5
- (void)eventNotificationWithEventInfo:(NSDictionary<NSString *,id> *)eventInfo {
6
7
}
Copied!
Make sure to NOT use anonymous inner class when using Java/Kotlin.
For more details on each callback, you can refer to the Leap Events (Reference).
Copy link