简体   繁体   English

蓝牙耳机上的拦截按钮

[英]Intercept button on bluetooth headset

I am trying to intercept the only one button on a bluetooth headset. 我试图拦截蓝牙耳机上唯一的一个按钮。 I have tried many things found on the site but none worked. 我已尝试在网站上找到很多东西,但都没有用。 The main activivity manages the bluetooth connection (using a code from https://github.com/sauravpradhan/AnySound2BT ). 主要活动来管理蓝牙连接(使用来自https://github.com/sauravpradhan/AnySound2BT的代码)。

I have the following manifest file : 我有以下清单文件:

...
<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>
...

When I click once, nothing happens and the second time the phone asks me to start "S voice" or "Google appli". 当我点击一次,没有任何反应,第二次手机要求我启动“S语音”或“Google appli”。

Thanks for any hint 谢谢你的任何提示

Karim 卡里姆

Their are many methods to intercept the button function if this button really did something. 如果这个按钮真的做了什么,它们有很多拦截按钮功能的方法。

According to your description, the phone asks you to start "S voice" or "Google appli" then I assume one of the button's combined function is "Voice Recognition Activation". 根据您的描述,手机会要求您启动“S语音”或“Google appli”,然后我假设其中一个按钮的组合功能是“语音识别激活”。

You can export the btsnoop log of the Android, then click the HFP tab, to find out the AT command, then you can understand what the button sends. 您可以导出Android的btsnoop日志,然后单击HFP选项卡,找到AT命令,然后您就可以了解按钮发送的内容。

Note that for all of the button on the headset, the long press,short press, and continue short press, the the press during calling or not calling,might have different meaning. 请注意,对于耳机上的所有按钮,长按,短按和继续短按,在通话或不通话期间按下可能具有不同的含义。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM