如何阻止 Google & Ask Alexa 从 MyApp 打开

问题描述

我正在通过蓝牙耳塞录制音频。当用户按住按钮时,应用程序会记录来自蓝牙耳塞的音频/语音,工作正常。

问题:当用户按住按钮时,有时会出现 Open with 弹出窗口,要求打开 Google or Ask Alexa 应用程序。 (附上截图以便更好理解)

  • 我们如何防止此 open with 弹出窗口出现在我们的应用中?
  • 我需要在 intent-filter 文件添加/更新任何 manifest 吗?
  • 我需要在 audiomanager 中更改模式吗?

对蓝牙音频使用以下代码

audioManager.setMode(AudioManager.MODE_IN_COMMUNICATION);
audioManager.startBluetoothSco();
audioManager.setBluetoothScoOn(true);

enter image description here

enter image description here

解决方法

在活动的清单中使用 android:exported="false"

<activity android:name=com.mymundane.app.MainActivity" 
    android:exported="false">
</activity>