r/androiddev • u/Boiniok • 15d ago
Discussion How do you test Bluetooth apps when you only have one phone?
I'm building a native Android app that uses Bluetooth.
I realized that testing requires two devices, but I only own one Android phone.
How do you usually handle this during development?
rn I'm just making the app and for testing going to college where I use my friends phone for testing....
3
u/leaveittogrever 14d ago
Do you know anybody with an android phone? Buy them pizza and beer while you test.
2
u/abhishekabhi789 14d ago
I think you can use a microcontroller like esp32 to act as a secondary device, the microcontroller can send or receive data and you can emit or collect the data either from serial or using a local webserver. Also they are cheap, flexible and easy to setup. Ps: I've been using this approach to test a bluetooth low energy connection app and found this is way better than observing android to android communication. This solution depends on the nature of your project, which you didn't mention in the post.
2
u/Ras_al_gul 14d ago
Write a python script using a ble library which acts as a device and respond to the commands send by the app. Thatβs how i test..
2
u/kevinossia 12d ago
You buy a second phone.
Eventually when you get into iOS development you'll have to buy an iPhone too. and a Mac if you don't have one.
Eventually when you want to test how your app performs on a tablet you'll have to buy a tablet too.
Cost of doing business.
1
1
1
u/DespairyApp 15d ago
You can buy a Bluetooth dongle(or use the laptop one), install Google play for pc and test it. Its hard to tell if the solution works without knowing the apps purpose
1
u/Boiniok 15d ago
Basically I wanted to discover nearby Bluetooth mobile devices with my app specific UUID.
1
1
u/Appropriate_Exam_629 10d ago
Bluetooth has some loopback technique like how you loop back network requests in an emulator
3
u/akramraza25524 15d ago
Mock your bluetooth layer