蓝牙耳机上的截取按钮

时间:2016-09-06 20:51:43

标签: android bluetooth headset

我试图拦截蓝牙耳机上唯一的一个按钮。我已尝试在网站上找到很多东西,但都没有用。主要活动来管理蓝牙连接(使用来自https://github.com/sauravpradhan/AnySound2BT的代码)。

我有以下清单文件:

...
<uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="21" />

    <uses-permission android:name="android.permission.MODIFY_AUDIO_SETTINGS" />
    <uses-permission android:name="android.permission.BLUETOOTH" />
    <uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
    <uses-permission android:name="android.permission.BROADCAST_STICKY" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppBaseTheme" >
        <activity
            android:name=".MainActivity"
            android:label="@string/app_name" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>

            <intent-filter android:priority="2147483647">
                <action android:name="android.intent.action.VOICE_COMMAND"/>
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

        </activity>


        <receiver android:name=".MyReceiver" >
            <intent-filter>
                <action android:name="android.bluetooth.device.action.ACL_CONNECTED" />
                <action android:name="android.bluetooth.device.action.ACL_DISCONNECTED" />
                <action android:name="android.bluetooth.device.action.ACL_DISCONNECT_REQUESTED" >
                </action>
            </intent-filter>

        </receiver>
...

当我点击一次时,没有任何反应,第二次手机要求我启动“S语音”或“Google appli”。

感谢任何提示

卡里姆

1 个答案:

答案 0 :(得分:0)

如果这个按钮确实有效,它们有很多拦截按钮功能的方法。

根据您的描述,手机会要求您启动&#34; S voice&#34;或者&#34; Google appli&#34;然后我假设其中一个按钮的组合功能是&#34;语音识别激活&#34;。

您可以导出Android的btsnoop日志,然后单击HFP选项卡,找到AT命令,然后您就可以了解按钮发送的内容。

请注意,对于耳机上的所有按钮,长按,短按,并继续短按,在通话或不通话期间按下可能有不同的含义。