Skip to content
Home » Mit App Inventor Wifi | Sơ Đồ Đấu Nối

Mit App Inventor Wifi | Sơ Đồ Đấu Nối

How to Make a Simple App--[NodeMCU-ESP8266] -PART1

Open the Google Play store or Apple App store on your phone or tablet, or use the buttons below to open the corresponding page:

After downloading, step through the instructions to install the Companion app on your device. You need to install the MIT App Inventor Companion app only once, and then you can leave it on your phone or tablet for whenever you use App Inventor. Note: There are some differences between the Android and iOS versions. Please review this page for more details.

Alternatively, you can scan the following QR codes to get either the iOS or Android app:

For iOS, scan this code to go to the Companion app on the Apple App Store.

For Android, scan this code to download the Android .APK file for the Companion app directly to your device. (Using an .APK file requires sideloading the app on your device and updating the app manually in the future.)

App Inventor will automatically show you the app you are building, but only if your computer (running App Inventor) and your device (running the Companion) are connected to the same Wi-Fi network. See a more detailed explanation of this here.

Go to App Inventor and open a project (or create a new one — use Project > Start New Project and give your project a name).

Then Choose “Connect” and “AI Companion” from the top menu in your browser:

A dialog with a QR code will appear on your PC screen. On your device, launch the MIT App Companion app just as you would do any app. Then click the “Scan QR code” button on the Companion, and scan the code in the App Inventor window:

Within a few seconds, you should see the app you are building on your device. It will update as you make changes to your design and blocks, a feature called “live testing.”

If you have trouble scanning the QR code or your device does not have a scanner, type the code shown on the computer into the Companion’s text area on your device exactly as shown. The code is directly below where the screen on your PC shows “Your code is” and consists of six characters. Type the six characters and choose the orange “Connect with code.” Do not type an Enter or carriage return: type just the six characters followed by pressing the orange button.

If your app does not appear on your device, the most likely problems are:

Điều khiển thiết bị bằng MIT App Inventor sử dụng NodeMCU ESP8266

Trong nội dung bài viết hôm nay mình sẽ giới thiệu với các bạn một chủ đề mới cách có thể tạo một App Android trên MIT App Inventor một cách nhanh chóng mà không cần phải biết về lập trình nhiều.

Bài viết sẽ hướng dẫn các bạn cách tạo một App đơn giản và điều khiển các thiết bị trong gia đình thông qua NodeMCU ESP8266. Để có thể nắm rõ hơn các bạn có thể tìm đọc các bài viết liên quan đến dự án.

Sơ đồ đấu nối

Các linh kiện cần thiết cho dự án

Tên linh kiện Số lượng Shopee
NodeMCU ESP8266 Mua ngay
Dây cắm (Cái – Cái) Mua ngay
Module Relay 5V Mua ngay
How to Make a Simple App--[NodeMCU-ESP8266] -PART1
How to Make a Simple App–[NodeMCU-ESP8266] -PART1

Tạo App Android bằng MIT APP INVENTOR

Để có thể tạo một App Android bằng MIT app inventor chúng truy cập vào link để tạo dự án nhé: http://appinventor.mit.edu

Bước đầu tiên các bạn Click vào Projects chọn “Start new project” để tạo một dự án mới.

Tiếp theo chúng ta cần đặt tên cho dự án.

Ở bên tay trái màn mình các bạn, chúng ta Click vào Button dùng để bật tắt thiết bị. Ở đây mình sẽ chọn 2 nút và đặt là “ON” và “OFF”.

Để có thể chỉnh sửa các thông số của Button các bạn Click vào và nó sẽ xổ ra các trường thông tin. Ở đây các bạn có thể đặt lại tên cho Button ở phần Text …

Tiếp theo, các bạn chọn mục Connectivity và cho Web và kéo thả vào Viewer nhé.

Sau khi đã cấu hình cho các Button và Web ta chọn vào Block để chuyển qua lập trình kéo thả Block.

Click vào “Button 1” chọn phần mà mình đã khoanh đỏ và kéo chúng vào vùng lập trình.

Tiếp tục, ta chọn “Web1” và kéo Block đã được đánh dấu. Ở phần này chúng ta sẽ cấu hình địa chỉ IP Web.

Chọn mục “Text” kéo block được khoanh đỏ vào vùng lập trình.

Tiếp theo ở mục Web1 chọn Block “Call Web.Get”.

Để biết được địa chỉ IP của NodeMCU ESP8266 ta cần nạp Code và bật Monitor lên xem nhé. Code mình để cuối bài viết các bạn tải về và

thực hiện nhé. Ở đây địa chỉ IP của mình là: 192.168.88.106

  • http://192.168.88.106/gpio/1
  • http://192.168.88.106/gpio/0

Các bạn kéo thả các Block lại với nhau giống như trên màn hình nhé.

Để có thể tải dự án về điện thoại, các bạn vào mục Build chọn App (project QR code for apk).

Quét mã QR code xuất hiện trên màn hình. Và các bạn tiến hành cài đặt App vào điện thoại nhé.

Như vậy là đã xong các bạn có thể điều khiển bật tắt thiết bị trên App điện thoại rồi.

Code

#include

const char* ssid = “Phamson”; const char* password = “phamtheson”; WiFiServer server(80); void setup() { Serial.begin(115200); //Default Baud Rate for NodeMCU delay(10); pinMode(2, OUTPUT); // Connect Relay to NodeMCU’s D4 Pin digitalWrite(2, 0); // Connect to WiFi network Serial.println(); Serial.println(); Serial.print(“Connecting to “); Serial.println(ssid); WiFi.begin(ssid, password); while (WiFi.status() != WL_CONNECTED) { delay(500); Serial.print(“.”); } Serial.println(“”); Serial.println(“WiFi connected”); // Start the server server.begin(); Serial.println(“Server started”); // Print the IP address Serial.println(WiFi.localIP()); } void loop() { // Check if a client has connected WiFiClient client = server.available(); if (!client) { return; } // Wait until the client sends some data Serial.println(“new client”); while(!client.available()){ delay(1); } String req = client.readStringUntil(‘\r’); Serial.println(req); client.flush(); int val; if (req.indexOf(“/gpio/0”) != -1) val = 0; else if (req.indexOf(“/gpio/1”) != -1) val = 1; else { Serial.println(“invalid request”); client.stop(); return; } // Set GPIO2 according to the request digitalWrite(2, val); client.flush(); String s = “HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n

\r\n

\r\nGPIO is now “; s += (val)?”high”:”low”; s += ”

“; }

A feature of AppInventor allows users to connect a device to a PC over Wi-Fi to test their apps. Below we explain in more detail how this process works.

To use the AppInventor connection over Wi-Fi, a user must download the MIT AI2 Companion App via the Google Play Store or Apple App Store, and install it directly to your phone.

The MIT AI2 Companion allows users to make a connection between an Android or iOS device and a PC over the MIT RendezVous Server.

The phone or table must be using Wi-Fi and not the cell network for Internet connectivity.

1. Your PC checks in with a 6-character code generated by the MIT AI2 Companion

2. MIT RendezVous Server records the IP address of your PC

3. Your device checks in with a 6-character code

4. MIT RendezVous Server records the IP address of your phone

5. MIT RendezVous Server tells the device and computer with the matching 6-character code the other’s IP address

6. Device and computer communicate directly using IP

Ideally our network situation should look like this:

Try the following steps to troubleshoot your wireless connection:

1. Try to reach http://rendezvous.appinventor.mit.edu from your PC

2. Try to reach http://rendezvous.appinventor.mit.edu from your device

3. If the steps above both work, try using the “ping” command to ping to the IP Address of the phone (displayed by the MIT AI2 Companion in its startup window). If you are using windows, type “ping” + *IP address of the phone* in cmd.exe window, if you are using mac or linux, type type “ping” + *IP address of the phone* in terminal window. Detailed instruction see http://www.wikihow.com/Ping-an-IP-Address

4. If all of these steps succeed and Wireless App Inventor still doesn’t work, then there may be a firewall between the computer and phone that is blocking ports 8001 and 9987. If you have a “telnet” program you can attempt to telnet from the computer to the phone on these ports. If the connection won’t complete, then there is likely a firewall in place that is blocking connections to the phone

If you do not pass step 4, your network most likely looks like this.

Many networks have firewalls set up that block connections to the phone. A way to get around this is to use your own or a local computer as a Wi-Fi router and have all computers and devices using App Inventor connect to the network using the new router. For detailed instruction setting up a computer as a router, see http://www.wikihow.com/Create-a-Wireless-Network

Check that your device is connected to Wi-Fi and not the cell network. On some devices and in some locations, even with Wi-Fi enabled, the phone continues to use the cell network. If this is happening to you, you can disable mobile networking (cell phone carrier based Internet connectivity) from your device’s settings menu.

/***********
Juan A. Villalpando
KIO4.COM
25/11/22
Version del módulo 9.2.4
Velocidad 9600
Carga el programa. Ve al Serial Monitor.
Escribe en un navegador 192.168.1.5
Pulsa los botones para encender o apagar el LED13 del Arduino.
***********/
#include

#define DEBUG true
SoftwareSerial esp8266(3,2);
// El TX del módulo al terminal 3 del Arduino.
// El RX del módulo al terminal 2 del Arduino.
void setup()
{
pinMode(13,OUTPUT);
Serial.begin(9600);
esp8266.begin(9600); // Importante la velocidad del módulo.
sendData(“AT+RST\r\n”,2000,DEBUG); // Borra la configuración que tenía el módulo
sendData(“AT+CWJAP=\”Nombre_de_tu_WiFi\”,\”Clave_de_tu_WiFi\”\r\n”, 2000, DEBUG);
delay(5000); // Espera un poco que conecte con el Router.
sendData(“AT+CWMODE=3\r\n”,1000,DEBUG); // Modo de cliente y servidor.
sendData(“AT+CIFSR\r\n”,1000,DEBUG); // En el Serial Monitor aparece la IP de cliente y servidor.
sendData(“AT+CIPMUX=1\r\n”,1000,DEBUG); // Multiples conexiones.
sendData(“AT+CIPSERVER=1,80\r\n”,1000,DEBUG); // El Puerto web es el 80
}
void loop(){
if(esp8266.available()) // Consulta si el módulo está enviando algún mensaje
{
if(esp8266.find(“+IPD,”))
{
delay(500);
int connectionId = esp8266.read()-48;
// Aquí las construcción de la PAGINA WEB.
String webpage = “HTTP/1.1 200 OK\r\n Content-Type: text/html\r\n\r\n\r\n”;
webpage += ”

KIO4.COM

“;
webpage += ”

“;
webpage += ”

“;
webpage += ”

“;
webpage += ”

\r\n\r\n”;
String cipSend = “AT+CIPSEND=”;
cipSend += connectionId;
cipSend += “,”;
cipSend +=webpage.length();
cipSend +=”\r\n”;
sendData(cipSend,500,DEBUG);
sendData(webpage,500,DEBUG);
// Lee el pin 13
int pin13 = digitalRead(13);
// Retorno de la lectura.
String retorno = “HTTP/1.1 200 OK\r\n Content-Type: text/html\r\n\r\n\r\n”;
if (pin13 == 1) {retorno += ” ON – Encendido”;}
if (pin13 == 0) {retorno += ” OFF – Apagado”;}
// ResponseCode App Inventor
cipSend = “AT+CIPSEND=”;
cipSend += connectionId;
cipSend += “,”;
cipSend += retorno.length();
cipSend +=”\r\n”;
sendData(cipSend,500,DEBUG);
sendData(retorno,500,DEBUG);
// Cierra la conexión
String closeCommand = “AT+CIPCLOSE=”;
closeCommand+=connectionId;
closeCommand+=”\r\n”;
sendData(closeCommand,500,DEBUG);
}
}
}
// Función para Enviar datos al Servidor.
String sendData(String command, const int timeout, boolean debug){
String response = “”;
esp8266.print(command); // Envía la información de command al servidor
long int time = millis();
while( (time+timeout) > millis())
{
while(esp8266.available())
{
// A response van los datos que regresan al servidor.
char c = esp8266.read(); // Va leyendo caracter a caracter.
response+=c;
// Consulta si en la información que regresa al servidor
// viene “GET /enci” o “GET /apag”
// Encenderá o apagará el LED13 del Arduino
if(response.indexOf(“GET /enci”) >0){
// Serial.print(“enciende”);
digitalWrite(13,HIGH);
}
if(response.indexOf(“GET /apag”) >0){
//Serial.print(“apaga”);
digitalWrite(13,LOW);
}
}
}
if(debug)
{
Serial.print(response);
}
return response;
}

// http://kio4.com/arduino/57modulowifi_2.htm
// Juan A. Villalpando
#include

SoftwareSerial esp8266(3,2);
// El TX del módulo al terminal 3 del Arduino.
// El RX del módulo al terminal 2 del Arduino.
int random_1 = 10;
int random_2 = 50;
String random_out = “0,0”;
String input_data = “”;
String fin = “”;
void setup(){
randomSeed(analogRead(A0));
Serial.begin(9600);
esp8266.begin(9600);
sendData(“AT+RST\r\n”,2000); // Borra la configuración que tenía el módulo
sendData(“AT+CWJAP=\”Nombre_de_tu_WiFi\”,\”Clave_de_tu_WiFi\”\r\n”, 2000);
delay(10000); // Espera un poco que conecte con el Router.
sendData(“AT+CWMODE=1\r\n”,1000); // Modo de cliente del Router.
sendData(“AT+CIFSR\r\n”,1000); // En el Serial Monitor aparece la IP del Servidor Web.
sendData(“AT+CIPMUX=1\r\n”,1000); // Multiples conexiones.
sendData(“AT+CIPSERVER=1,80\r\n”,1000); // Crea Servidor Web, puerto 80
}
void loop(){
if(esp8266.available()){
while(esp8266.available()){
char c = esp8266.read();
input_data += c;
if(input_data.indexOf(“genera”) > 0){
random_1 = random(10,50);
random_2 = random(50,99);
random_out = (String) random_1 + “,” + (String) random_2;
input_data = “”;
fin = “finalizado”;
}
}
}
// Return responseContent
if(fin == “finalizado”){
String header = “HTTP/1.1 200 OK\r\n Content-Type: text/html; \r\n”;
header += “Content-Length: “;
header += random_out.length();
header += “\r\nConnection: close\r\n\r\n”;
header += random_out;
sendData(“AT+CIPSEND=” + String(0) + “,” + header.length() + “\r\n”, 500);
sendData(header,1000);
// sendData (“AT+CIPCLOSE=” + String(0) + “\r\n”, 1000);
fin = “”;
}
}
// Envia datos al servidor y recibe la respuesta de los AT.
String sendData(String command, const int timeout){
String response = “”;
esp8266.print(command); // Envía la información de command al servidor
long int time = millis();
while( (time+timeout) > millis()){
while(esp8266.available()){
// A response van los datos que regresan al servidor.
char c = esp8266.read(); // Va leyendo caracter a caracter.
response+=c;
}
}
Serial.print(response);
return response; // Devuelve la respuesta del AT
}

It took me a while to figure out how the web server “knew” to work off IP address 192.168.1.9, but then I saw it in the COM24 log as the result of the AT+CIFSR command, and I imagine you read that output to get the IP address hard coded into the AI2 app.

Now we are going to carry out the previous example but we will create an Access Point (SoftAP – Soft Access Point), that is, the module will create a network independent from the Router, it will not be connected to the Router.

The code will create a network called ESP_81411C and the Web Server will have as IP: 192.168.4.1

For this we will change these lines…

void setup(){
randomSeed(analogRead(A0));
Serial.begin(9600);
esp8266.begin(9600);
sendData(“AT+RST\r\n”,2000); // Borra la configuración que tenía el módulo
// sendData(“AT+CWJAP=\”Nombre_de_tu_WiFi\”,\”Clave_de_tu_WiFi\”\r\n”, 2000);
// delay(10000); // Espera un poco que conecte con el Router.
sendData(“AT+CWMODE=2\r\n”,1000); // NOW IS A SOFT ACCESS POINT, MODE = 2
sendData(“AT+CIFSR\r\n”,1000); // En el Serial Monitor aparece la IP del Servidor Web. (192.168.4.1)
sendData(“AT+CIPMUX=1\r\n”,1000); // Multiples conexiones.
sendData(“AT+CIPSERVER=1,80\r\n”,1000); // Crea Servidor Web, puerto 80
}

We must change the IP in the code…

It is also convenient to install the application, since we are going to change the network and the MIT Companion will be in the Router’s network.

Once the application is installed, we go to the WiFi configuration and establish the ESP_81411C network

It is not necessary to put a Password since in this default configuration it does not have it.

If we wanted to change the name of the network and put a password on it, we would put this line:

3.- Remove the Serial Monitor, in case you have it open.

4.- We load this sketch in the IDE and upload it…

It is convenient from time to time to remove the power from the ESP8266 and put it back if it does not load well.

Summary

/*
* This sketch demonstrates how to set up a simple HTTP-like server.
* The server will set a GPIO pin depending on the request
* http://server_ip/gpio/0 will set the GPIO2 low,
* http://server_ip/gpio/1 will set the GPIO2 high
* server_ip is the IP address of the ESP8266 module, will be
* printed to Serial when the module is connected.
*/
#include

const char* ssid = “nombredemirouter”;
const char* password = “contraseñadelrouter”;
// Create an instance of the server
// specify the port to listen on as an argument
WiFiServer server(80);
void setup() {
Serial.begin(9600);
delay(1500);
// prepare GPIO2
pinMode(2, OUTPUT);
digitalWrite(2, LOW);
// Connect to WiFi network
Serial.println();
Serial.println();
Serial.print(“Connecting to “);
Serial.println(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(“.”);
}
Serial.println(“”);
Serial.println(“WiFi connected”);
// Start the server
server.begin();
Serial.println(“Server started”);
// Print the IP address
Serial.println(WiFi.localIP());
}
void loop() {
// Check if a client has connected
WiFiClient client = server.available();
if (!client) {
return;
}
// Wait until the client sends some data
Serial.println(“new client”);
while(!client.available()){
delay(1);
}
// Read the first line of the request
String req = client.readStringUntil(‘\r’);
Serial.println(req);
client.flush();
// Match the request
int val;
if (req.indexOf(“/gpio/0”) != -1)
val = 0;
else if (req.indexOf(“/gpio/1”) != -1)
val = 1;
else {
Serial.println(“invalid request”);
client.stop();
return;
}
// Set GPIO2 according to the request
digitalWrite(2, val);
client.flush();
// Prepare the response
String s = “HTTP/1.1 200 OK\r\nContent-Type: text/html\r\n\r\n

\r\n

\r\nGPIO is now “;
s += (val)?”high”:”low”;
s += ”

\n”;
// Send the response to the client
client.print(s);
delay(1);
Serial.println(“Client disonnected”);
// The client will actually be disconnected
// when the function returns and ‘client’ object is detroyed
}

5.- When there is upload, remove the GPIO 0 to GND cable and open the Serial Monitor. Restart.

6.- Once the sketch is loaded we can remove the Arduino, connect an LED to the GPIO2 and feed the module with 3.3V

If you don’t have a 3.3V power supply, you can use the Arduino to power the module, note that you don’t need RX or TX.

See the App Inventor Extensions document about how to use an App Inventor Extension.For questions about this extension or bug reports please start a new thread in the App Inventor community. Thank you.For feature requests please contact me by email. To be a sponsor of a new method already is possible starting from only 10 USD! With your contribution you will help the complete App Inventor community. Thank you.

Dec 22th, 2015: Version 1: initial release.

July 7th, 2016: Version 2: macAddress method added.

Aug 11th, 2016: Version 2a: avoid DX execution failed error: build each extension separately

Nov 27th, 2016: Version 3: BSSID method added

Feb 25th, 2017: Version 3a: bugfix IllegalArgumentException: Receiver not registered: null while switching screens

May 10th, 2017: Version 3b: bugfix IllegalArgumentException: Receiver not registered while switching screens

Aug 14th, 2017: Version 4: correspondingRSSIs, SignalStrength, ConnectionInfo, Is5GHzBandSupported added

Aug 16th, 2017: Version 5: correspondingBSSIs added

Dec 6th, 2017: Version 5a: bugfix configuredSSIDs, see also here. Thank you Edgar for the error report.

Dec 14th, 2017: Version 5b: bugfix ConnectSSID, see also here. Thank you again Edgar for the error report.

Apr 8th, 2018: Version 6: new method AccessPointIP added

Apr 13th, 2018: Version 7: connect without password

Aug 29th, 2018: Version 8: Disconnect method added

Nov 6th, 2018: Version 9: Dnsservers method added

Jan 23th, 2019: Version 10: SDK 26 update: dangerous permission android.permission.ACCESS_COARSE_LOCATION removed. What is a dangerous permission? The method AvailableSSIDs including its corresponding event have been removed.

Jan 28th, 2019: Version 11: AvailableSSIDs added again. Additionally example project provided about how to use it together with the location sensor and GPS enabled.

Oct 21th, 2019: Version 12: AfterWifiNegotiation event added

Oct 21th, 2019: Version 13: RemoveSSID added

Oct 21th, 2019: Version 14: LocalIP: returns wifi ip if its enabled else the cellular one

May 25th, 2021: Version 14 recompiled, see also here.

Nov 12th, 2021: Version 15: android.permission.ACCESS_NETWORK_STATE added for App Inventor nb188 release, see also here.

Aug 31st, 2023:
Version 16: ACCESS_FINE_LOCATION and WRITE_SETTINGS permissions added,ConnectSSID method for Android >= 10 uses the network request API, see also hereHaveSystemWritePermission and ApiLevel methods added,IsGpsEnabled, IsLocationPermissionGranted and RequestLocationPermission method added,MacAddress method removed, does not work for Android M, see also hereRemoveSSID method removed, suppressWarning properties replaced by ErrorOccurred eventNote: this version of the extension is not compatible with earlier versions. You therefore have to remove the extension from your project and then import it as new extension.

Dec 10th, 2023: Version 16a:
Extension rebuilt to avoid “ERROR: DX returned an error code” for projects, having 2 extensions or more which use proguard to obfuscate their code,
see also Pull request 3004.

Some useful blocks to use in a wireless lan.Required permissions: android.permission.ACCESS_WIFI_STATE, android.permission.CHANGE_WIFI_STATE, android.permission.ACCESS_NETWORK_STATE, android.permission.ACCESS_FINE_LOCATION, android.permission.WRITE_SETTINGS

Returns whether Success Message should be suppressed.

Specifies whether Success Message should be suppressed.

Return the local IP Address. Returns wifi ip if its enabled else the cellular one.Sponsor of this block is Marius. Thank you!

Return the MAC Address of the device.Sponsor of this block is Niko. Thank you!

Get current WiFi state: true or false.

Enable WiFi.You can hide the success message after setting the suppressSuccessMessage property to false.Note: starting from Android 10, it is not possible anymore to enable Wifi programmatically, see also this stackoverflow answer, therefore a dialog for the user will be provided, see also this Activity Starter solution.

Disable WiFi.You can hide the success message after setting the suppressSuccessMessage property to false.Note: starting from Android 10, it is not possible anymore to disable Wifi programmatically, see also this stackoverflow answer, therefore a dialog for the user will be provided, see also this Activity Starter solution.

Get current WiFi SSID (Service Set Identifier).Note: to be able to test this block, you have to build the app, because the permission CHANGE_WIFI_STATE is not available in the companion app.Note: Precondition to use this method is to grant location permission. Also GPS must be enabled. See the example project about how to use it..

Get current WiFi BSSID (the MAC address of the access point).Thank you burrowmoor for being the sponsor of this method.Note: to be able to test this block, you have to build the app, because the permission CHANGE_WIFI_STATE is not available in the companion app.Note: Precondition to use this method is to grant location permission. Also GPS must be enabled. See the example project about how to use it..

Get a list of available SSIDs (Service Set Identifiers). WiFi must be enabled for this.Note: to be able to test this block, you have to build the app, because the permission CHANGE_WIFI_STATE is not available in the companion app.Note: Precondition to use this method is to grant location permission. Also GPS must be enabled. See the example project about how to use it..

Note: Android will get more and more restricted. In a future Android release the AvailableSSIDs method will stop working, see also this note in the Android documentation: “The ability for apps to trigger scan requests will be removed in a future release.”

Get current connection info.For details, see also WiFiInfo documentation.

Check, if 5 GHz Band is supported. Returns true or false.

Get signal strength (RSSI) in a range between 0 and 100.This algorithm is used to calculate the signal strength..

Get IP address of the access point.Thank you Eric for being the sponsor of this method.

Return a list of DNS servers (primary and secondary) of the current network.Note: The method returns the IP address of the gateway router when DNS is not configured inside the router.Thank you Gabriel for being the sponsor of this method.

Connect to a SSID (Service Set Identifier). Available for Android >= 10.The new peer to peer API to bootstrap configuration for secondary devices is used, which is available starting from Android 10, see also here. This API requires the permission WRITE_SETTIMGS.Note: Creating a connection using this API does not provide an internet connection to the app or to the device!!!Bypassing user approvalOnce the user approves a network to connect to in response to a request from a specific app, the device stores the approval for the particular access point. If the app makes a specific request to connect to that access point again, the device skips the user approval phase and automatically connects to the network. If the user chooses to forget the network while connected to a network requested by the API, then this stored approval for that combination of app and network is removed, and any future request from the app must be approved by the user again.Note: to be able to test this block, you have to build the app, because the permission WRITE_SETTINGS is not available in the companion app.

Disconnect. Available for Android >= 10.Note: after disconnecting the device might reconnect automatically to the next available known network.Thank you Wei Zheng for being the sponsor of this method.

Returns the API Level of the device.

Check, whether we have system write permission or not. Returns true or false. In case of false, the Android write settings menu of the app will be opened automatically.

Returns true, if location permission have been granted.

Request location permission. Required for SSID, BSSID, AvailableSSIDs methods.

Event indicating that Available SSIDs (Service Set Identifiers) have been scanned.A list of the available SSIDs is provided in parameter availableSSIDs. The SSID having the best signal is provided in parameter bestSSID. A list of the corresponding RSSIs is provided in parameter correspondingRSSI. A list of corresponding BSSIs is provided in parameter correspondingBSSIs.Thank you Tal for being the sponsor of the correspondingRSSI and correspondingBSSI functionality.

Event indicating that network is available. Available starting from Android 10.

Event indicating that error occurred.

Version 16 tested successfully on Samsung Galaxy A54 running Android 13.

Q1: I used Taifun Wifi Extension to search & connect to Available wifi network. But my problem rise when I connect using SSID & PASSWORD,
the connection never succeeds. But if I set My access point to open network & I remove password from connect extension, the connection establish
but only for few seconds & my phone connecting to another configured wifi network. My phone use android 8 api 26.A: Problem solved. The SSID NAME in my case it must be between 6 to 11 character, the SSID NAME must be start with Character (do not use number for first character), the Password must at least 9 character . Now connection are made successfully. Thank you pjack2021.Q2: After successfully connecting, when I go to the Android wifi settings. I click on my wifi (to see the information) and there is nothing. IP address, subnet mask, etc. but the connection to the wifi network is successful.A: Yes, this is the correct behavior for devices starting from Android 10. See also the explanation from Google here: Network request API: targets apps that need to connect to a peer device, such as when configuring an IoT device or transferring files to a camera. In such cases, the peer device starts up a SoftAP and the API allows the app to guide the user to connect to the device. The resulting network is not intended to provide internet access, can’t be used by the system, and can’t be used by any app except the configuring app. User selection and approval is required the first time a connection is made to a new peer. Intended for IoT configuration apps and IoT file transfer apps..

The test app is available in Google Play. You can test the example following these steps

You can buy this extension (aix file).With your payment you accept the terms and conditions below.Payment options

1. Please transfer 12 USD via Paypalto Pura Vida Apps

2.

After having received your payment I will be happy to send the download link to you. Please let me know your Google account!
I usually will send the download link not later than 24 hours after having received your payment.Thank you! Taifun

I still provide the latest free version 15 of the extension here without support. There might be permission issues for some methods. Also the Connect method will not work anymore for newer devices.
It is recommended to use the paid version instead.Download TaifunWiFi extension (aix file) Version 15Download Wifi example project (aia file)Back to top of page …

hello, I have my application that works well, it connects to wifi, no problem (both my box and APPointesp8266). I’m looking to make a screen where all the possible connections are displayed, then choose and enter the password.I looked on the site in other sites, I found nothing is it possible? (as in Bleutooth where we are looking for devices)Thanks for reading

hello, I have my application that works well, it connects to wifi, no problem (both my box and APPointesp8266). I’m looking to make a screen where all the possible connections are displayed, then choose and enter the password.

you might want to try the wifi extensionhttps://puravidaapps.com/wifi.phpsee also the extensions directory here https://puravidaapps.com/extensions.phpTaifun

Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Hello, I studied the code it works, the application connect. When I connect to Access point on the esp8266, the connection comes back to that of origne, “message no internet access” which is normal. How to do?thank you.

sorry, I do not understand… you might want to elaborate…Taifun

sorry it’s my phone who does this, as the connection does not have internet access, it changes network, without notifying me.on the other hand when I am in development, I have get SSID,when I make built apk impossible, it asks me for the authorization that the apk uses wifi, I answer yes ?. It connects well.

Hello,I’m still looking for a solution for my SSID problem.When I am in development I have the SSID of the network connected to my telephone companion.when I build the application and then launch it, I cannot have the network SSID connected.I forgot something?thank you

Hello again,

I have now moved on to some wifi identification and am using your wifi manager ext

In particular .AvailableSSIDs which is working great! However it has a delay from calling to listing SSID’s of about (3 seconds).

Is there any way of reducing that time delay? If so, ill be happy to sponsor of course.

Cheers

Ric

scanning takes its time… the only thing to make this faster is to use a faster device…

however what I could implement is to add a Progress event, which could provide each new found SSID immediately similar to the Progress event in the packagemanager extension

EDIT: sorry, I promised too much…the scanning first must be executed, then the complete result is given back, it seems to be there is not possibility to get a progress meanwhile scanning…

Taifun

Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.

Hello @Taifun , I just Try your AvailableSSID.aia with the wifi extension on it, and worked well.but I unable to parsing SSID that I want by giving the event “When GotAvailableSSIDs ” do text comparelike picture bellow

The result it always false “Access point unavailable” , even I know my access point exist.

It test with of AvailableSSIDs the result is False it mean The Result Value of availableSSIDs not strings or mybe integer is this correct?

how to get ride of my problem , to extract SSID that I Want in availableSSIDs

Thanks

Ok I resolved my problem

great… and next time please ask in the community of the builder you are usingthank you

Taifun

MIT APP INVENTOR 2 -nodemcu wifi car control app
MIT APP INVENTOR 2 -nodemcu wifi car control app

Keywords searched by users: mit app inventor wifi

Send Text From Arduino To Mit App Using Esp8266 Wifi - Mit App Inventor  Help - Mit App Inventor Community
Send Text From Arduino To Mit App Using Esp8266 Wifi – Mit App Inventor Help – Mit App Inventor Community
Send Text From Arduino To Mit App Using Esp8266 Wifi - Mit App Inventor  Help - Mit App Inventor Community
Send Text From Arduino To Mit App Using Esp8266 Wifi – Mit App Inventor Help – Mit App Inventor Community
Home Automation With Mit App Inventor And Esp8266 - Iot Projects Ideas
Home Automation With Mit App Inventor And Esp8266 – Iot Projects Ideas
Mit App Inventor 2 -Nodemcu Wifi Car Control App - Youtube
Mit App Inventor 2 -Nodemcu Wifi Car Control App – Youtube
Receiving Data From Mcu (Esp8266) And Displaying On App Over Local Network  Wifi - Mit App Inventor Help - Mit App Inventor Community
Receiving Data From Mcu (Esp8266) And Displaying On App Over Local Network Wifi – Mit App Inventor Help – Mit App Inventor Community
Esp32. Wifi. Webserver. Led On/Off. Static Ip. Soft Access Point - Internet  Of Things - Mit App Inventor Community
Esp32. Wifi. Webserver. Led On/Off. Static Ip. Soft Access Point – Internet Of Things – Mit App Inventor Community
Ho To Check If A Wifi Connection Is Established? - Mit App Inventor Help - Mit  App Inventor Community
Ho To Check If A Wifi Connection Is Established? – Mit App Inventor Help – Mit App Inventor Community
App Inventor Sends Information To Esp8266 By Wifi - Tutorials And Guides - Mit  App Inventor Community
App Inventor Sends Information To Esp8266 By Wifi – Tutorials And Guides – Mit App Inventor Community
Esp32. Wifi. Webserver. Led On/Off. Static Ip. Soft Access Point - Internet  Of Things - Mit App Inventor Community
Esp32. Wifi. Webserver. Led On/Off. Static Ip. Soft Access Point – Internet Of Things – Mit App Inventor Community
Read/Write Serial Data Over Wlan 802.11 Between Mobile (Mit App) And Rs232  Gateway - Mit App Inventor Help - Mit App Inventor Community
Read/Write Serial Data Over Wlan 802.11 Between Mobile (Mit App) And Rs232 Gateway – Mit App Inventor Help – Mit App Inventor Community
Connecting Esp8266 (Nodemcu) With Android App (Mit App Inventor) Especially  The Longitude And Latitude From A Gps Module - Mit App Inventor Help - Mit  App Inventor Community
Connecting Esp8266 (Nodemcu) With Android App (Mit App Inventor) Especially The Longitude And Latitude From A Gps Module – Mit App Inventor Help – Mit App Inventor Community
Wifi Y Esp32- Appinventor - Youtube
Wifi Y Esp32- Appinventor – Youtube
Mit App Inventor 2 Meets Esp8266!!! | By J3 | Kidstronics | Medium
Mit App Inventor 2 Meets Esp8266!!! | By J3 | Kidstronics | Medium
Using Esp8266 And Mit App Inventor To Control A Relay | Iot | Iot, Inventor,  Relay
Using Esp8266 And Mit App Inventor To Control A Relay | Iot | Iot, Inventor, Relay
Send Text From Arduino To Mit App Using Esp8266 Wifi - Mit App Inventor  Help - Mit App Inventor Community
Send Text From Arduino To Mit App Using Esp8266 Wifi – Mit App Inventor Help – Mit App Inventor Community
Send String From Mit App Text Box To Esp8266 And Arduinomega - Internet Of  Things - Mit App Inventor Community
Send String From Mit App Text Box To Esp8266 And Arduinomega – Internet Of Things – Mit App Inventor Community
Wifi Transmo: Wi-Fi Peer To Peer Text, File Transfer With Live Audio  Transmitting - Extensions - Mit App Inventor Community
Wifi Transmo: Wi-Fi Peer To Peer Text, File Transfer With Live Audio Transmitting – Extensions – Mit App Inventor Community
Using Esp8266 And Mit App Inventor To Control A Relay | Iot | Relay, App,  Iot
Using Esp8266 And Mit App Inventor To Control A Relay | Iot | Relay, App, Iot
Điều Khiển Thiết Bị Bằng Mit App Inventor Sử Dụng Nodemcu Esp8266 | Arduino  Kit
Điều Khiển Thiết Bị Bằng Mit App Inventor Sử Dụng Nodemcu Esp8266 | Arduino Kit
Esp32. Wifi. Webserver. Led On/Off. Static Ip. Soft Access Point - Internet  Of Things - Mit App Inventor Community
Esp32. Wifi. Webserver. Led On/Off. Static Ip. Soft Access Point – Internet Of Things – Mit App Inventor Community

See more here: kientrucannam.vn

Leave a Reply

Your email address will not be published. Required fields are marked *