【问题标题】:Intercept button on bluetooth headset蓝牙耳机上的拦截按钮
【发布时间】:2016-09-06 20:51:42
【问题描述】:

我试图拦截蓝牙耳机上唯一的一个按钮。我已经尝试了很多在网站上找到的东西,但都没有奏效。主要活动管理蓝牙连接(使用来自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 voice”或“Google appli”。

感谢任何提示

卡里姆

【问题讨论】:

    标签: android bluetooth headset


    【解决方案1】:

    如果这个按钮真的做了什么,他们有很多方法来拦截按钮功能。

    根据您的描述,手机要求您启动“S voice”或“Google appli”,然后我假设按钮的组合功能之一是“语音识别激活”。

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

    注意,对于耳机上的所有按键,长按、短按、继续短按、通话中的按或不通话的按,可能有不同的含义。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-11-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多