i think you are following a tutorial like this : https://www.electronicshub.org/hc-05-bluetooth-module/
i do not know what app you exactly have and what data it sends. This is very likely the problem. Apps like the one used here are not very complicated, any BT communication in Android is based on theBluetoothAdapter
class. You can write your own app easily following https://www.youtube.com/watch?v=iFtjox9_zAI or copy code from the net.
To add sending and receiving functionality cf Android sample bluetooth code to send a simple string via bluetooth
The sending and receiving is done using RfcommSockets
to that an OutputStream
is attached , this is in the code
if(bondedDevices.size() > 0) {
Object[] devices = (Object []) bondedDevices.toArray();
BluetoothDevice device = (BluetoothDevice) devices[position];
ParcelUuid[] uuids = device.getUuids();
BluetoothSocket socket = device.createRfcommSocketToServiceRecord(uuids[0].getUuid());
socket.connect();
outputStream = socket.getOutputStream();
inStream = socket.getInputStream();
and
public void write(String s) throws IOException {
outputStream.write(s.getBytes());
Alternatively load the app Bluetooth Terminal HC-05 from PlayStore and try with it https://play.google.com/store/apps/details?id=project.bluetoothterminal&hl=de
If you want to send an entire .apk file and not simple command strings you have to use another protocol / bluetooth profile option (FTP, OPP or OBEX) . For this get the app Bluetooth File Transfer https://www.androidpit.com/how-to-send-apps-with-bluetooth
For being able to send entire files you have to implement a file system on your STM32, else you can only write binary into memory with a program that reads the data from the Bluetooth receiving buffer and then copies it to memory as raw binary data.
(the technology behind transfering files with bluetooth is explained in http://www.diva-portal.org/smash/get/diva2:1020079/FULLTEXT01.pdf - File Transfer Using Bluetooth)