Android 应用程序处于后台时阻止Internet访问
我正试图从广播接收器发布一些数据,但当我的应用程序长时间处于后台时,它无法连接到internet,我在日志中看到以下错误:Android 应用程序处于后台时阻止Internet访问,android,broadcastreceiver,android-broadcastreceiver,Android,Broadcastreceiver,Android Broadcastreceiver,我正试图从广播接收器发布一些数据,但当我的应用程序长时间处于后台时,它无法连接到internet,我在日志中看到以下错误: java.net.ConnectException: failed to connect to android-guru.com/5.230.136.35 (port 80) after 90000ms: isConnected failed: ECONNREFUSED (Connection refused) 即使可以从同一设备的浏览器访问我的服务器。 当我的应用程序处
java.net.ConnectException: failed to connect to android-guru.com/5.230.136.35 (port 80) after 90000ms: isConnected failed: ECONNREFUSED (Connection refused)
即使可以从同一设备的浏览器访问我的服务器。
当我的应用程序处于前台或几分钟后我的应用程序进入后台时,它工作正常。我今天遇到了同样的问题,并发现这是因为我的手机中启用了“电池节省器”/“电池优化”。我把它关掉后,网络开始工作了 你能公布你的收信人代码吗?请检查你的网络连接