如何使用android以稳定的方式连接到ESP8266无线接入点? [英] How to use android to connect to an ESP8266 access point without internet in a stable way?

查看:206
本文介绍了如何使用android以稳定的方式连接到ESP8266无线接入点?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个Wifi Micro控制器ESP8266,它也有一个接入点.我提到过其他博客,这些博客谈论以编程方式连接到访问点,并尝试了两种方式

I have a Wifi Micro controller ESP8266 which also has an access point. I have referred to other blogs which talk about programmatically connecting to an access point and tried both the way

  1. 使用公开的标准APIS

  1. Using the exposed standard APIS

wifiManager.enableNetwork(netId,true); wifiManager.saveConfiguration(); wifiManager.reconnect();

wifiManager.enableNetwork(netId, true); wifiManager.saveConfiguration(); wifiManager.reconnect();

使用上面带有@隐藏的API

Using the APIs which have @ hide on them

wifiManager.connect(netId,ActionListener)

wifiManager.connect(netId, ActionListener)

我面临的问题是,在连接到接入点一段时间后,它与esp8266接入点断开连接,并以上述两种方法连接回路由器.

The problem I am facing is that some time after i connect to the access point its getting disconnected from the esp8266 access point and connecting back to my router in both the above mentioned methods.

如果我通过顶部栏或通过设置应用程序进行连接,则其连接稳定,并且从未断开连接,甚至收到通知

If i connected via the top bar or through the settings app its connecting in a stable way and never disconnects and I even get the notification

Wi-Fi has no internet access

以编程方式连接时,没有收到没有互联网访问通知.设置应用程序如何在我的应用程序无法连接的情况下稳定地连接到接入点.

I don't get the no internet access notification when i connect programmatically. How is the settings app able to connect to the access point in a stable way while my App is not able to.

我正在运行Androidn 6.0.1 API 23

I am running Androidn 6.0.1 API 23

推荐答案

我发现Android连接到ESP8266或ESP32热点有2个主要问题.我正在使用AP-STA双模式.我读到,由于ESP8266和ESP32具有单个无线电处理AP和STA,因此连接易碎且不稳定,这就是为什么我的Android设备在配置过程中与AP断开连接的原因.

I figured 2 main issues with Android connecting to ESP8266 or ESP32 hotspot. I was using AP-STA dual mode. I read up that since ESP8266 and ESP32 have single radio handling AP and STA the connection will be fragile and not very stable which is why my android device was getting disconnected from AP during configuration.

解决方案是将ESP *设备在连接到接入点时在配置过程中和STA模式下保持在SOFT_AP模式,而永远不要在AP-STA双模式下.这完全解决了我的稳定性问题.

The solve for this is keep the ESP* device in SOFT_AP mode during configuration and STA mode when its connected to the Access point and never in AP-STA dual mode. This completely solve my stability issues.

这篇关于如何使用android以稳定的方式连接到ESP8266无线接入点?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆