简体   繁体   English

Android 5.0+在通知区域中隐藏用户的“蓝牙配对请求”

[英]Android 5.0+ hides “Bluetooth pairing request” from user in notification area

I see this very confusing issue on GPE devices (Nexus, Moto G) with Android 5.0+ (still exists in Moto G with 5.1). 我在使用Android 5.0+的GPE设备(Nexus,Moto G)上看到了这个非常令人困惑的问题(仍然存在于Moto G和5.1中)。 I`m working on android application that connects to a custom board via Bluetooth (RFCOMM). 我正在开发通过蓝牙(RFCOMM)连接到自定义板的android应用程序。 When I initiate connection Android frequently shows "Bluetooth pairing request" dialog and ask user click "pair" button. 当我发起连接Android时,频繁显示“蓝牙配对请求”对话框,并要求用户点击“配对”按钮。 It is normal behaviour. 这是正常的行为。 But with Google Play Edition devices like Nexus(5,6,9) and Moto G(may be with other GPE devices too). 但是使用像Nexus(5,6,9)和Moto G这样的Google Play Edition设备(可能还有其他GPE设备)。 This messages do not appears to user. 用户不会看到此消息。 Instead android hides it in notification area. 相反,android将其隐藏在通知区域中。 As result users do not understand that some user actions required. 结果用户不理解需要一些用户操作。 From user prospective app hangs up. 从用户预期的应用程序挂断。

This dialog is not a part of the application. 此对话框不是应用程序的一部分。 With Samsung Galaxy devices I do not see this issues. 使用三星Galaxy设备,我没有看到这个问题。

Is there any workaround to show this dialog on top always? 是否有任何解决方法始终显示此对话框?

I can think about two options: 我可以考虑两个选择:

  1. You could start an Intent that would bypass the lock screen (if there is one) and display a msg to the user that an action is required ( Android Lollipop - Bypass lock screen for popup activity ). 您可以启动一个绕过锁定屏幕的Intent(如果有的话)并向用户显示需要操作的消息( Android Lollipop - 用于弹出活动的旁路锁定屏幕 )。

  2. You could add your own notification with a beep (using the MediaManager) and vibration to make sure the user is aware that he needs to approve the pairing. 您可以使用蜂鸣声(使用MediaManager)和振动添加自己的通知,以确保用户知道他需要批准配对。 bear in mind that the user can configure the phone not to display notifications on any device running Android 5.x (in settings->sound and notifications) so It's won't always solve your problem. 请记住,用户可以将手机配置为不在任何运行Android 5.x的设备上显示通知(在设置 - >声音和通知中),因此它并不总能解决您的问题。

Good luck! 祝好运!

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

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