use of com.optimizely.ab.android.event_handler.EventRescheduler in project android-sdk by optimizely.
the class APISamplesInJava method samplesForDoc_EventDispatcher.
public static void samplesForDoc_EventDispatcher(Context context) {
// -- sample starts here
// Using an anonymous class here to implement the EventHandler interface.
// Feel free to create an explicit class that implements the interface instead.
EventHandler eventHandler = new EventHandler() {
@Override
public void dispatchEvent(LogEvent logEvent) throws Exception {
// Send event to our log endpoint as documented in
// https://developers.optimizely.com/x/events/api/index.html
}
};
// Build a manager
OptimizelyManager optimizelyManager = OptimizelyManager.builder().withSDKKey("<Your_SDK_Key>").withEventDispatchInterval(60, TimeUnit.SECONDS).withEventHandler(eventHandler).build(context);
// With the new Android O differences, you need to register the
// service for the intent filter you desire in code instead of in the manifest.
EventRescheduler eventRescheduler = new EventRescheduler();
context.registerReceiver(eventRescheduler, new IntentFilter(WifiManager.SUPPLICANT_CONNECTION_CHANGE_ACTION));
}
Aggregations