IHeadsetActionCallback

interface IHeadsetActionCallback

IHeadsetActionCallback

Description :

This interface represent the API for all event related to Headset event(Hardware button). This interface is used with the STWHeadsetManager in order to delegate event linked to Headset event.

Example of use :

  • Implementation :
    
    
    
    IHeadsetActionCallback mHeadsetActionCallback = new IHeadsetActionCallback() {
    public boolean shouldHandleActions() {
    //code ...
    }
    
    public void onHeadsetMediaButtonClicked() {
    //code ...
    }
    
    public void onHeadsetButtonPressed() {
    //code ...
    }
    
    public void onHeadsetButtonReleased() {
    //code ...
    }
    
    public void onHeadsetSosButtonPressed() {
    //code ...
    }
    
    public void onHeadsetSosButtonReleased() {
    //code ...
    }
    }
                
  • Registration:
    to register your callback you must call :
    
    
    
        STWHeadsetManager.getInstance().registerForHeadsetMediaButtonCallback(context, mHeadsetActionCallback);
    
  • Unregister:
    to unregister your callback you must call :
    
    
        STWHeadsetManager.getInstance().unregisterForHeadsetMediaButtonCallback(context);
    

Functions

Link copied to clipboard
abstract fun onHeadsetButtonPressed()
Callback triggered when click (action down) on media button of headset working with AtX events
Link copied to clipboard
abstract fun onHeadsetButtonReleased()
Callback triggered when click (action up) on media button of headset working with AtX events
Link copied to clipboard
abstract fun onHeadsetMediaButtonClicked()
Callback triggered when click on media button of standard headset Note that : long click is not detected for standard headset because of event is catched from device to open for example google voice or other recognizing voice application).
Link copied to clipboard
abstract fun onHeadsetSosButtonPressed()
Callback triggered when click (action down) on SOS button of headset working with AtX events
Link copied to clipboard
abstract fun onHeadsetSosButtonReleased()
Callback triggered when click (action up) on SOS button of headset working with AtX events
Link copied to clipboard
abstract fun shouldHandleActions(): Boolean
Called every time receiving an event to check if we should handle event.