Connect to sleeping android phone

rmac2190
Posts: 3
Joined: Wed Dec 26, 2018 5:01 pm

Connect to sleeping android phone

Postby rmac2190 » Wed Dec 26, 2018 5:30 pm

How to connect to a sleeping android phone and receive it's Bluetooth “name” . The phone would be paired with the esp32. I need to be able to find up-to three different phone names and preform a different task depending on how many phones are found (0-3). So is there a way to connect to a sleeping android phone with Bluetooth as a car does?

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

Re: Connect to sleeping android phone

Postby czuvich » Fri Dec 28, 2018 4:05 am

Have you tried using one of the example clients in the ESP32 BLE folder and connecting to the device? As long as you don’t require any custom services on the Android side then I’d try that.

You could even try an app on your phone or tablet to connect to the android device.

The only unknown for me is I think you’ll need to know either the BLE server’s broadcasting UUID or name to know that you need to connect to it (assuming your ESP32 is not running a LCD or other interface).

rmac2190
Posts: 3
Joined: Wed Dec 26, 2018 5:01 pm

Re: Connect to sleeping android phone

Postby rmac2190 » Fri Dec 28, 2018 3:07 pm

Thanks for the reply czuvich:

I tried the "esp-idf/examples/bluetooth/bt_discovery/" example and it does what I need but only when the android phone is in "visible mode" even after pairing the phone and the esp32. I think I need to connect with some service to be auto connected (like a car establishes a connection with a phone) buit that is where I am lost?

rmac2190
Posts: 3
Joined: Wed Dec 26, 2018 5:01 pm

Re: Connect to sleeping android phone

Postby rmac2190 » Fri Dec 28, 2018 3:26 pm

Administrator:
I think this post might get more replies in the ESP32 IDF forum. Could you move it there?

Thanks

ESP_Sprite
Posts: 9761
Joined: Thu Nov 26, 2015 4:08 am

Re: Connect to sleeping android phone

Postby ESP_Sprite » Fri Dec 28, 2018 3:38 pm

Sure. Moved Arduino -> ESP-IDF

czuvich
Posts: 36
Joined: Tue Sep 04, 2018 1:58 am

Re: Connect to sleeping android phone

Postby czuvich » Sat Dec 29, 2018 7:18 pm

It’s possible while an Android device is in doze mode the BLE server is only available to “certified” clients.

I think this question is better suited on StackOverflow for connecting to Android in Doze. It may depend on the version of Android, hardware certification, etc. If you’ve got some Android dev chops, you could try running a custom app that exposes a foreground service and then try connecting to that. Do you have an example of an app that does what you’re wanting?

Who is online

Users browsing this forum: Google [Bot] and 108 guests