在Android中,我们可以通过AudioManager来判断是否有声音在播放。
实例1:
源码地址: PhoneWindowManager.java (frameworks\base\policy\src\com\android\internal\policy\impl)  
源码如下:

  /**
     * @return Whether fm is being played right now.
     */
    boolean isFmActive() {
        final AudioManager am = (AudioManager)mContext.getSystemService(Context.AUDIO_SERVICE);
        if (am == null) {
            Log.w(TAG, "isFmActive: couldn't get AudioManager reference");
            return false;
        }
        return am.isFmActive();
    }

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-26
  • 2021-09-18
猜你喜欢
  • 2021-10-31
  • 2022-12-23
  • 2021-12-20
  • 2022-12-23
  • 2022-12-23
  • 2021-06-25
  • 2022-12-23
相关资源
相似解决方案