STWHeadSetManager

open class STWHeadSetManager

STWHeadSetManager

Description :

This class represent the API for all actions/event related to Headset.

This class offers several possible operations defined in the following list :

  • Headset plug
  • Headset unplug

Example of use :

  • Implementation :
    
    private IHeadSetListener mHeadSetListener = new IHeadSetListener() {
    
    public void onHeadSetPlugged() {
    
    //code
    
    }
    public void onHeadSetUnplugged() {
    
    // code
    
    }
    };
    
  • Registration :
    
            STWHeadSetManager.getInstance().registerForHeadsetManagerEvents(mHeadSetListener);
            
  • Unregister :
    
            STWHeadSetManager.getInstance().unregisterForHeadsetManagerEvents(mHeadSetListener);
            

Functions

Link copied to clipboard
open fun getInstance(): STWHeadSetManager
Get or create the single instance of STWHeadSetManager.
Link copied to clipboard
open fun registerForHeadsetManagerEvents(@NonNull headSetListener: IHeadSetListener)
Register the specified listener to be notified by any Hardware event
Link copied to clipboard
open fun unregisterForHeadsetManagerEvents(@NonNull headSetListener: IHeadSetListener)
Unregister the specified listener to not receive any Bluetooth events