void OnApplicationPause(bool isPaused)
 {
     if (!isPaused)
     {
         AndroidAppEventsBinding.RegisterAudioMgrEventsHandler(name, strRingerModeChangedEventName);
         SyncAudioToOSSoundMode();
     }
     else
     {
         AndroidAppEventsBinding.UnregisterAudioMgrEventsHandler();
     }
 }
    void Awake()
    {
        // Destroy this GameObject on platforms different from Android. Keep this handler in the editor for flow tests.
        if (Application.platform != RuntimePlatform.Android && !Application.isEditor)
        {
            Destroy(gameObject);

            return;
        }

        if (instance != null)
        {
            Debug.LogWarning("[AndroidAudioEventsHandler] Another instance of this singleton is present in the scene: " + Application.loadedLevelName);
            Destroy(this.gameObject);

            return;
        }

        instance = this;
        GameObject.DontDestroyOnLoad(gameObject);

        AndroidAppEventsBinding.RegisterAudioMgrEventsHandler(name, strRingerModeChangedEventName);
    }
 /// <summary>
 /// Syncs the Unity sound to OS sound mode. Useful for Android where the OS Sound Mode is independent from the Unity sound mode.
 /// On iOS this method will always enable the AudioListener volume and set it to 1f.
 /// On Android if the OS Ringer Mode is set to silent or vibrate, it will disable the Unity sound (set the AudioListener volume to 0f).
 /// This behavior should be provided out of the box by Unity on Android... :(
 /// </summary>
 public void SyncAudioToOSSoundMode()
 {
     Debug.Log("[AndroidAudioEventsHandler] SyncAudioToOSSoundMode()");
     UpdateAudioRingerMode(AndroidAppEventsBinding.GetOSRingerMode());
 }
 void OnApplicationQuit()
 {
     AndroidAppEventsBinding.UnregisterAudioMgrEventsHandler();
 }