gpt4 book ai didi

android - Delphi 10 Android Broadcastreceiver for Headset 插件不工作。我做错了什么?

转载 作者:行者123 更新时间:2023-11-29 19:55:30 33 4
gpt4 key购买 nike

我使用 Delphi 10 为我的 Android 手机创建一个媒体播放器应用程序。我使用以下组件将广播接收器包含到我的应用程序中: https://github.com/barisatalay/delphi-android-broadcast-receiver-component

如果我为电话来电请求消息(如在演示应用程序中)并且我使用:android.intent.action.PHONE_STATE,这将非常有效

但是,如果我添加对耳机插件消息的请求:android.intent.action.ACTION_HEADSET_PLUG我的应用没有收到消息。

知道我可能做错了什么吗?

最佳答案

正确的 Intent Action 名称是

android.intent.action.HEADSET_PLUG

不是

android.intent.action.ACTION_HEADSET_PLUG

这记录在 IntentACTION_HEADSET_PLUG 的文档:

public static final String  ACTION_HEADSET_PLUG 

Added in API level 1

Broadcast Action: Wired Headset plugged in or unplugged. Same as ACTION_HEADSET_PLUG, to be consulted for value and documentation.

If the minimum SDK version of your application is LOLLIPOP, it is recommended to refer to the AudioManager constant in your receiver registration code instead.

Constant Value: "android.intent.action.HEADSET_PLUG"

关于android - Delphi 10 Android Broadcastreceiver for Headset 插件不工作。我做错了什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36776223/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com