Listen to the close click event

This topic guides you through how to listen for the mini program close click event.

Overview

From IAPConnect 2.34.0, Griver supports the close click event by implementing the GriverTitleBarCloseClickEvent interface. The following sections provide the detailed steps:

Step 1. Implement GriverTitleBarCloseClickEvent

To listen for the mini program close click event, implement the GriverTitleBarCloseClickEvent interface, and write your business logic in the onCloseClick function:

copy
public class DemoGriverTitleBarCloseClickEvent implements GriverTitleBarCloseClickEvent {
    @Override
    public void onCloseClick() {
    }

    @Override
    public void onInitialized() {

    }

    @Override
    public void onFinalized() {

    }
}

Step 2. Register the close click event

Register the close click event during initializing:

copy
  Griver.registerEventHandler(
                new GriverEventManifest(DemoGriverTitleBarCloseClickEvent.class.getName(), Arrays.asList(
                        GriverTitleBarCloseClickEvent.class.getName()), App.class));