Event Listener

The Android SDK provides event listener to listen to various events on the client app. Through these event delegates, TapTalk.io notifies the client app of events that happen on your app.

You can listen through general events from the Live Chat SDK through the TapTalkLiveListener class. An instance of TapTalkLiveListener will be required to initialize the Live Chat SDK. A more complete implementation will be explained in this page.

Application.java
TapTalkLive.init(
    CONTEXT, 
    APP_KEY_SECRET, 
    CLIENT_APP_ICON, 
    CLIENT_APP_NAME,
    new TapTalkLiveListener() {
        @Override
        public void onInitializationCompleted() {
            // Initialization success
        }
        
        @Override
        public void onInitializationFailed(TTLErrorModel error) {
            // Initialization failed
        }

        @Override
        public void onNotificationReceived(TAPMessageModel message) {
            // TapTalk.io SDK receives a message notification
            // Calling super will show TapTalk.io's default notification for the app
            super.onNotificationReceived(message);
        }
    
        @Override
        public void onCloseButtonInHomePageTapped(Activity activity) {
            // User closes the home page
        }
    
        @Override
        public void onCloseButtonInCreateCaseFormTapped(Activity activity) {
            // User closes the create case form
        }
    
        @Override
        public void onCloseButtonInCaseListTapped(Activity activity) {
            // User closes the case list page
        }
    
        @Override
        public void onTaskRootChatRoomClosed(Activity activity) {
            // A chat room activity was closed by user when no other activity in the application is present
            // You may start another activity to keep the app open, otherwise the app will stay closed
    }
    
        @Override
        public void onSeeAllMessagesButtonTapped(Activity activity) {
            // User taps the See All Messages button in home page
            // Calling super will open the case list page
            super.onSeeAllMessagesButtonTapped(activity);
        }
    
        @Override
        public void onCreateNewMessageButtonTapped(Activity activity) {
            // User taps the New Messages button in home or case list page
            // Calling super will open the create new case form
            super.onCreateNewMessageButtonTapped(activity);
        }
    
        @Override
        public void onCaseListItemTapped(Activity activity, TAPMessageModel lastMessage) {
            // User taps a case from a list in home or case list page
            // Calling super will open the selected chat room
            super.onCaseListItemTapped(activity, lastMessage);
        }
    
        @Override
        public void onFaqChildTapped(Activity activity, TTLScfPathModel scfPath) {
            // User taps a FAQ from a list in home or FAQ details page
            // Calling super will open the selected FAQ details page
            super.onFaqChildTapped(activity, scfPath);
        }
    
        @Override
        public void onCloseButtonInFaqDetailsTapped(Activity activity, TTLScfPathModel scfPath) {
            // User closes the FAQ details page
        }
    
        @Override
        public void onTalkToAgentButtonTapped(Activity activity, TTLScfPathModel scfPath) {
            // User taps the Talk to Agent button in home or FAQ details page
            // Calling super will open the create new case form
            super.onTalkToAgentButtonTapped(activity, scfPath);
        }
    }
);

TapTalkLiveListener listens to changes in the following methods:

Method Name

Invoked When

onInitializationCompleted()

TapTalkLive instance has finished initialization process.

onInitializationFailed()

TapTalkLive instance initialization failed with an error.

onNotificationReceived()

User receives new message from TapTalk.io through notification. Returns the newly received message.

onCloseButtonInHomePageTapped()

User closes the home page. Returns the home activity instance.

onCloseButtonInCreateCaseFormTapped()

User closes the create case form page. Returns the create case form activity instance.

onCloseButtonInCaseListTapped()

User closes the case list page. Returns the case list activity instance.

onTaskRootChatRoomClosed()

A chat room activity was closed by user when no other activity in the application is present (application will close).

onSeeAllMessagesButtonTapped()

User taps the See All Messages button in home page. Returns the current activity instance.

onCreateNewMessageButtonTapped()

User taps the New Messages button in home or case list page. Returns the current activity instance.

onCaseListItemTapped()

User taps a case from a list in home or case list page. Returns the current activity instance and selected case's last message.

onFaqChildTapped()

User taps a FAQ from a list in home or FAQ details page. Returns the current activity instance and selected SCF Path.

onCloseButtonInFaqDetailsTapped()

User closes the FAQ details page. Returns the current activity instance and selected SCF Path.

onTalkToAgentButtonTapped()

User taps the Talk to Agent button in home or FAQ details page. Returns the current activity instance and selected SCF Path.

Last updated

#621:

Change request updated