TapTalk.io Documentation
  • Introduction
  • OneTalk Omnichannel Documentation
    • Getting Started with OneTalk
      • Team Members
      • Add Topic
      • Assign Agent to Topic
      • Paid Proactive Chat
    • Channel Integration
      • Telegram Integration
      • WhatsApp SME Integration
      • Instagram DM Integration
      • Facebook Messenger Integration
      • Live Chat Integration (iOS, Android, Web)
        • OneTalk Live Chat for Android
          • Get Started
          • Event Listener
          • Authentication
          • Case & Topic
          • Navigate Live Chat UI
          • Customize UI Appearance
        • OneTalk Live Chat for iOS
          • Get Started
          • Background Process in TapTalk.io Omnichannel iOS
          • Event Delegate
          • Authentication
          • Case & Topic
          • Navigate Live Chat UI
          • Customize UI Appearance
        • OneTalk Live Chat for Web
          • Get Started
          • Callback
          • Method
        • OneTalk Live Chat for React Native
          • Get Started - Android
          • Authentication - Android
          • Get Started - iOS
          • Authentication - iOS
        • OneTalk Live Chat for Flutter
          • Get Started - Android
          • Get Started - iOS
      • Google Business Messages Integration
      • Google Business Profile Integration
      • Tokopedia Integration
    • Integration API
      • Inbox API
      • User/Contact API
    • Live Chat Widget Callback Function
    • Social Channel Button
    • Custom Chatbot Integration
      • Get Started
      • Edit or Delete Chatbot
      • Development
    • QnA via API
    • Webhook
  • PowerTalk Chat SDK Documentation
    • Getting Started with PowerTalk
    • PowerTalk Android
      • Get Started
      • Enable Chat Features
      • Authentication
      • TapUI and TapCore
      • Background Process in TapTalk.io
      • Connection
      • Event Listener
      • Push Notification
      • General
      • User
      • Room List
        • Room List - TapUI
        • Room List - TapCore
      • Chat Room and Messages
        • Chat Room and Messages - TapUI
        • Chat Room and Messages - TapCore
      • Contact
      • Message Type
      • Customize UI Appearance
      • Customize Chat Features
      • Customize Chat Message Bubble
      • Customize Navigation Bar
      • Deep Linking
      • Error Codes
    • PowerTalk iOS
      • Get Started
      • TapUI and TapCore
      • Background Process in TapTalk.io
      • Implement Application Delegate
      • Authentication
      • Connection
      • Event Delegate
      • Push Notification
      • General
      • User
      • Room List
        • Room List - TapUI
        • Room List - TapCore
      • Chat Room and Messages
        • Chat Room and Messages - TapUI
        • Chat Room and Messages - TapCore
      • Contact
      • Message Type
      • Customize UI Appearance
      • Customize Chat Features
      • Customize Chat Message Bubble
      • Customize Navigation Bar
      • Deep Linking
      • Error Codes
    • PowerTalk React Native
      • Get Started - Android
      • Get Started - iOS
    • PowerTalk Flutter
      • Get Started - Android
      • Get Started - iOS
    • Javascript SDK
      • Get Started
      • Authentication
      • Connection
      • General
      • Event Listener
      • User
      • Room List
      • Chat Room
      • Messages
      • Contact
      • Message Type
    • Server API
      • Get Started
      • Base URL
      • Authentication
      • User
      • Contact
      • Message
      • Room
    • Webhook
      • Get Started
      • Webhook Payload
  • MeetTalk SDK Documentation
    • Getting Started with MeetTalk
    • MeetTalk Android
      • Get Started
      • Event Listener
    • MeetTalk iOS
      • Get Started
      • Implement Application Delegate
      • Event Delegate
  • SendTalk API Documentation
    • Introduction
    • Whatsapp Verification
Powered by GitBook
On this page

Was this helpful?

  1. OneTalk Omnichannel Documentation
  2. Channel Integration
  3. Live Chat Integration (iOS, Android, Web)
  4. OneTalk Live Chat for Android

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
import io.taptalk.taptalklive.TapTalkLive;
import io.taptalk.taptalklive.Listener.TapTalkLiveListener;
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLErrorModel;
import io.taptalk.taptalklive.API.Model.TTLScfPathModel;
import io.taptalk.TapTalk.Model.TAPMessageModel;

...

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);
        }
        
        @Override
        public void onFaqContentUrlTapped(Activity activity, TTLScfPathModel scfPath, String url) {
            // User taps a url in FAQ content
            // Calling super will open the selected url using TapTalk.io's in-app browser
            super.onFaqContentUrlTapped(activity, scfPath, url);
        }
        
        @Override
        public void onFaqContentUrlLongPressed(Activity activity, TTLScfPathModel scfPath, String url) {
            // User long presses a url in FAQ content
            // Calling super will copy the selected url to the device's clipboard
            super.onFaqContentUrlLongPressed(activity, scfPath, url);
        }
        
        @Override
        public void onFaqContentEmailAddressTapped(Activity activity, TTLScfPathModel scfPath, String email) {
            // User taps an email address in FAQ content
            // Calling super will open the device's email composer for the selected email address
            super.onFaqContentEmailAddressTapped(activity, scfPath, email)
        }
        
        @Override
        public void onFaqContentEmailAddressLongPressed(Activity activity, TTLScfPathModel scfPath, String email) {
            // User long presses an email address in FAQ content
            // Calling super will copy the selected email address to the device's clipboard
            super.onFaqContentEmailAddressLongPressed(activity, scfPath, email)
        }
        
        @Override
        public void onFaqContentPhoneNumberTapped(Activity activity, TTLScfPathModel scfPath, String phone) {
            // User taps a phone number in FAQ content
            // Calling super will open the device's phone app to dial the selected phone number
            super.onFaqContentPhoneNumberTapped(activity, scfPath, phone)
        }
        
        @Override
        public void onFaqContentPhoneNumberLongPressed(Activity activity, TTLScfPathModel scfPath, String phone) {
            // User long presses a phone number in FAQ content
            // Calling super will copy the selected phone number to the device's clipboard
            super.onFaqContentPhoneNumberLongPressed(activity, scfPath, phone)
        }
    }
);
Application.kt
import io.taptalk.taptalklive.TapTalkLive
import io.taptalk.taptalklive.Listener.TapTalkLiveListener
import io.taptalk.taptalklive.API.Model.ResponseModel.TTLErrorModel
import io.taptalk.taptalklive.API.Model.TTLScfPathModel
import io.taptalk.TapTalk.Model.TAPMessageModel

...

TapTalkLive.init(
    CONTEXT, 
    APP_KEY_SECRET, 
    CLIENT_APP_ICON, 
    CLIENT_APP_NAME,
    object : TapTalkLiveListener() {
        override fun onInitializationCompleted() {
            // Initialization success
        }
        
        override fun onInitializationFailed(error: TTLErrorModel?) {
            // Initialization failed
        }

        override fun onNotificationReceived(message: TAPMessageModel?) {
            // TapTalk.io SDK receives a message notification
            // Calling super will show TapTalk.io's default notification for the app
            super.onNotificationReceived(message)
        }
        
        override fun onCloseButtonInHomePageTapped(activity: Activity?) {
            // User closes the home page
        }
    
        override fun onCloseButtonInCreateCaseFormTapped(activity: Activity?) {
            // User closes the create case form
        }
    
        override fun onCloseButtonInCaseListTapped(activity: Activity?) {
            // User closes the case list page
        }
    
        override fun 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 fun 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 fun 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 fun onCaseListItemTapped(activity: Activity?, lastMessage: TAPMessageModel?) {
            // 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 fun onFaqChildTapped(activity: Activity?, scfPath: TTLScfPathModel?) {
            // 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 fun onCloseButtonInFaqDetailsTapped(activity: Activity?, scfPath: TTLScfPathModel?) {
            // User closes the FAQ details page    
        }
    
        override fun onTalkToAgentButtonTapped(activity: Activity?, scfPath: TTLScfPathModel?) {
            // 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)
        }
        
        override fun onFaqContentUrlTapped(activity: Activity?, scfPath: TTLScfPathModel?, url: String?) {
            // User taps a url in FAQ content
            // Calling super will open the selected url using TapTalk.io's in-app browser
            super.onFaqContentUrlTapped(activity, scfPath, url)
        }
        
        override fun onFaqContentUrlLongPressed(activity: Activity?, scfPath: TTLScfPathModel?, url: String?) {
            // User long presses a url in FAQ content
            // Calling super will copy the selected url to the device's clipboard
            super.onFaqContentUrlLongPressed(activity, scfPath, url)
        }
        
        override fun onFaqContentEmailAddressTapped(activity: Activity?, scfPath: TTLScfPathModel?, email: String?) {
            // User taps an email address in FAQ content
            // Calling super will open the device's email composer for the selected email address
            super.onFaqContentEmailAddressTapped(activity, scfPath, email)
        }
        
        override fun onFaqContentEmailAddressLongPressed(activity: Activity?, scfPath: TTLScfPathModel?, email: String?) {
            // User long presses an email address in FAQ content
            // Calling super will copy the selected email address to the device's clipboard
            super.onFaqContentEmailAddressLongPressed(activity, scfPath, email)
        }
        
        override fun onFaqContentPhoneNumberTapped(activity: Activity?, scfPath: TTLScfPathModel?, phone: String?) {
            // User taps a phone number in FAQ content
            // Calling super will open the device's phone app to dial the selected phone number
            super.onFaqContentPhoneNumberTapped(activity, scfPath, phone)
        }
        
        override fun onFaqContentPhoneNumberLongPressed(activity: Activity?, scfPath: TTLScfPathModel?, phone: String?) {
            // User long presses a phone number in FAQ content
            // Calling super will copy the selected phone number to the device's clipboard
            super.onFaqContentPhoneNumberLongPressed(activity, scfPath, phone)
        }
    }
)

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.

onFaqContentUrlTapped()

User taps a url in FAQ content. Returns the current activity instance, selected SCF Path, and the selected url.

onFaqContentUrlLongPressed()

User long presses a url in FAQ content. Returns the current activity instance, selected SCF Path, and the selected url.

onFaqContentEmailAddressTapped()

User taps an email address in FAQ content. Returns the current activity instance, selected SCF Path, and the selected email address.

onFaqContentEmailAddressLongPressed()

User long presses an email address in FAQ content. Returns the current activity instance, selected SCF Path, and the selected email address.

onFaqContentPhoneNumberTapped()

User taps a phone number in FAQ content. Returns the current activity instance, selected SCF Path, and the selected phone number.

onFaqContentPhoneNumberLongPressed()

User long presses a phone number in FAQ content. Returns the current activity instance, selected SCF Path, and the selected phone number.

PreviousGet StartedNextAuthentication

Last updated 28 days ago

Was this helpful?