Page 1 of 1

Need sample to communicate APK with ESP32 over socket

Posted: Tue Dec 20, 2016 7:40 pm
by Ritesh
Hi,

We are working on ESP32 chip from RTOS firmware and application side.

Here, we have just started to work on all side and meanwhile I have started to look ESP32-idd RTOS SDK to start development stuffs. I am thinking to create communication between APK and ESP32 would be over socket interface in which API will send some data after connecting with configured SSID and password. On the other end, ESP32 will send feedback to APK with some response or alerts soemtimg like that.

Does anyone has implemented code something like that?

Please let me know if anyone has implemented that type of code or provide me sample code for that which will be more helpful for us.

Re: Need sample to communicate APK with ESP32 over socket

Posted: Fri Dec 23, 2016 6:22 pm
by Ritesh
Hi,

Does anyone has any sample code for that?

Re: Need sample to communicate APK with ESP32 over socket

Posted: Fri Dec 23, 2016 7:21 pm
by kolban
You might need to define what "APK" might be? I don't think that is an acronym that I am familiar with in connection with common ESP32 programming.

Re: Need sample to communicate APK with ESP32 over socket

Posted: Sat Dec 24, 2016 6:16 pm
by alqeon
@kolban: I think he meant Android's APK (Android Package)..

Up till now i havent seen an example. but you might get lucky if you search for esp8266 examples.

also there isn't really the need for a specific example on the apk side. because what you need is just an TCP connection or UDP package sent to a specific ip (the android's device IP).

For starters i would suggest using a simple IFTTT apk (https://www.youtube.com/watch?v=nbMfb0dIvYc&t=2s)..

Re: Need sample to communicate APK with ESP32 over socket

Posted: Sat Dec 24, 2016 6:25 pm
by martinayotte
I think he means Android Package for APK, in other words, an Android application.
This app could either use HTTPClient or plain sockets to communicate with the ESP server.

Re: Need sample to communicate APK with ESP32 over socket

Posted: Sat Dec 24, 2016 6:33 pm
by Ritesh
martinayotte wrote:I think he means Android Package for APK, in other words, an Android application.
This app could either use HTTPClient or plain sockets to communicate with the ESP server.
Yes, Socket based communication.I have developed socket based applications into ESP8266 when I was working into ESP8266..

I think that type of code will be worked into ESP32 chip as well. Still, provide me link or sample code for that..

Re: Need sample to communicate APK with ESP32 over socket

Posted: Sat Dec 24, 2016 6:38 pm
by kolban
Here is an example fragment of an ESP32 application being a socket server. One can then connect a socket client to this listener. By and large, the ESP32 seems to provide a faithful implementation of the sockets API so any books or other resources you find that talk to writing networking apps in C using sockets should work fine. For me, I have found study of the sockets API to be highly rewarding. Once one gets one's mind around sockets programming, TCP/IP networking applications fall into place. If I were to think about writing a networking application using TCP/IP, I would say a firm grasp of sockets is required to succeed.

https://github.com/nkolban/esp32-snippe ... t_server.c

Re: Need sample to communicate APK with ESP32 over socket

Posted: Sat Dec 24, 2016 6:49 pm
by Ritesh
kolban wrote:Here is an example fragment of an ESP32 application being a socket server. One can then connect a socket client to this listener. By and large, the ESP32 seems to provide a faithful implementation of the sockets API so any books or other resources you find that talk to writing networking apps in C using sockets should work fine. For me, I have found study of the sockets API to be highly rewarding. Once one gets one's mind around sockets programming, TCP/IP networking applications fall into place. If I were to think about writing a networking application using TCP/IP, I would say a firm grasp of sockets is required to succeed.

https://github.com/nkolban/esp32-snippe ... t_server.c
Thanks for reply.

Yes. I agree socket is best way to communicate over WiFi.

I will check your example and will let you know if need any help from your side.

Re: Need sample to communicate APK with ESP32 over socket

Posted: Fri Jan 13, 2017 9:47 pm
by rudi ;-)
Ritesh wrote:
kolban wrote:Here is an example fragment of an ESP32 application being a socket server. One can then connect a socket client to this listener. By and large, the ESP32 seems to provide a faithful implementation of the sockets API so any books or other resources you find that talk to writing networking apps in C using sockets should work fine. For me, I have found study of the sockets API to be highly rewarding. Once one gets one's mind around sockets programming, TCP/IP networking applications fall into place. If I were to think about writing a networking application using TCP/IP, I would say a firm grasp of sockets is required to succeed.

https://github.com/nkolban/esp32-snippe ... t_server.c
Thanks for reply.

Yes. I agree socket is best way to communicate over WiFi.

I will check your example and will let you know if need any help from your side.
hi
for inspiration,
here is a demo
it runs on esp32 as standalone http/tcp server,
have a download link to an APK ( done with basic4android) , that is inside the http server ( on esp flash )
and you can then comunicate with the esp32 server over http ( browser ) and tcp ( client )
and sure, if you open the link in your browswer on android device, you can download the apk from the esp32 server, install it on your device and you comunicate with esp32 over the apk by tcp client / sockets or http with the browser.

best wishes
rudi ;-)

Re: Need sample to communicate APK with ESP32 over socket

Posted: Sat Jan 14, 2017 10:56 am
by Ritesh
Thanks for Reply.. Let me check and will let you know..