我使用Delphi 10为我的android手机创建一个mediaplayer应用程序。我用下面的组件包括一个BroadcastReceiver到我的应用程序: https://github.com/barisatalay/delphi-android-broadcast-receiver-componentDelphi 10 Android Broadcastreceiver for Headset Plugin不起作用。我错了什么?
这完美的作品,如果我请求消息电话来电(如在演示程序),我使用:android.intent.action.PHONE_STATE
但是,如果我添加了耳机插件消息的请求: android.intent.action.ACTION_HEADSET_PLUG 我的应用程序没有收到消息。
任何想法我可能会做错什么?
你的意思是德尔福10.0西雅图,或Delphi 10.1柏林?您的应用程序首先表现为接受“ACTION_HEADSET_PLUG”意图吗? –
在柏林(不清楚西雅图),你可以通过['IFMXApplicationEventService.SetApplicationEventHandler()']获得一个Android'Intent'(http://docwiki.embarcadero.com/Libraries/en/FMX.Platform.IFMXApplicationEventService.SetApplicationEventHandler )和['TMessageManager.SubscribeToMessage()'](http://docwiki.embarcadero.com/Libraries/en/System.Messaging.TMessageManager.SubscribeToMessage)['TMessageReceivedNotification'](http://docwiki.embarcadero.com /RADStudio/en/List_of_FireMonkey_Message_Types#FMX.Platform.TMessageReceivedNotification.Android)消息。 –
请参阅Embarcadero的[AndroidIntents](https://sourceforge.net/p/radstudiodemos/code/HEAD/tree/branches/RADStudio_Berlin/Object%20Pascal/Mobile%20Snippets/AndroidIntents/)示例。 –