Send and receive data from ESP8266 to Android App

I am trying to build a prototype for an IOT device that can be controlled from an app. I want the app to be able to light an LED on the device, and I want the device to be tell the app when motion is detected. I am having trouble with getting the communication to work.

My first question is, what's the best way send data from the arduino to an an android app? I have read on this forum that I should send the data to a ThingSpeak server, then read to that from the android app. Is there any way to cut the middle man?

As far as sending data from android to the arduino: I have found several examples of lighting an LED from an android app but none of them work in a user-friendly way. Most of them involve typing in the IP address of the arduino/esp.

Essentially, what I want is for the connection to work similar to other smart devices. For example, for my robot vacuum, it asked me for my wifi connection data, then it had me connect my phone to the robot vacuum network. Then it does some magic and the robot works. My phone can tell the vacuum when to go, and the vacuum tells my phone battery and location info. I want my device to setup to be the same. So, essentially I want the Arduino/ESP to broadcast an access point. I want to provide my wifi data to my app, connect to that access point from my android app, and then have my app able to communicate with my device.

Is what I'm looking to do possible with the ESP? I am a beginner in IOT devices and networking, but an experienced programmer. I don't want an off the shelf solution like blynk, or something built with MIT app builder. I want to program this app myself. I could really use some help on the connection side. Thanks.

Well I could be wrong, but the ESP can either be an AP or connected with local credentials to your AP, and then run a Web server with a .local URL. You then just use the Web browser on the mobile (whether Android or fruit) to manipulate it.

@solongandthanksforallthefish? I am surprised no-one has snagged that "handle" before. :astonished:

are you implementing the Android app yourself?
if you are using an ESP32 BLE is probably the simplest way to go
the app connects over BLE to the ESP which can receive instruction and upload data.
if an ESP8266 run an AP as @Paul_B suggests