简体   繁体   English

屏幕关闭时继续接收数据包

[英]keep receiving packet when the screen is turned off

I am writing a local communication system between Android phones that are connected to the local Wifi Access Point. 我正在编写连接到本地Wifi接入点的Android手机之间的本地通信系统。 In the design of my system, the Android phones should notify the owner once they received an UDP broadcast packet from the Windows server. 在我的系统设计中,Android手机一旦从Windows服务器收到UDP广播数据包,便应通知所有者。

The system works just fine when the screen of the phone is turned on. 当手机屏幕打开时,系统工作正常。 But it is found that, once the screen of Android phone is turned off, the phone just ignored the packet, just like no message is received. 但是发现,一旦关闭Android手机的屏幕,该手机就会忽略该数据包,就像没有收到任何消息一样。

I have tried Google for many time, but still no luck. 我已经尝试Google了很多次,但还是没有运气。 Actually I really don't know what keyword should I use for doing the searching. 实际上,我真的不知道应该使用哪个关键字进行搜索。

Do any one know how can I do what I want? 有人知道我该怎么做吗? Thank you very much 非常感谢你

You will need: 你会需要:

  • a WakeLock WakeLock
  • a WifiLock WifiLock
  • a suit of armor, to better defend yourself from users who do not like it that you are keeping the device awake and WiFi radio powered on 一套防具,以更好地保护自己免受不喜欢它的用户的侵害,因为您会保持设备处于唤醒状态并打开WiFi无线电

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

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