I tried to use an extension and convert the file to string and send it. But the converted string is not displayed or is not converted to String.
I used these two extensions to convert it to string : KIO4_File2String ,KIO4_Base641
I am supposed to send the file through bluetooth only ,not supposed to use sharing component.
Can someone please help!
Here an example to sends file from App to Arduino with SdCard reader.
When I use KIO4_Base641, I convert the file to string and set the label with the converted String but the label gets the String “File not found”.
What does the activityStarter.ResultUri look like?
The base64 block requires it in a certain format to work.
ActivityStarter.ResultUri has this path “content://com.android.externalstorage.documents/document/primary%3ADownload%2FIM_20200522_205146.jpg”
even if the path is this “//media/external/file/372930” , it still shows file not found.
You will need to do two things…
- Get Taifun’s File Extension to use the block:
- You may then need to edit that output with text manipulation blocks to suit the requirements of the base64 block - it will need to start with a
/
, so you may have to remove/storage/emulated/0
Hello Ramesh
What is the final destination of the file?
My app should work in a way where in I can pick any file and send using bluetooth.So I can pick any file.I cant specifically say the destination of the file.
Well, how a file is sent can depend on how the receiving device can receive files
For example, sending a file from an Android Phone to a Windows PC is entirely different to sending the same file to a microprocessor such as an Arduino…
Ohh . I’m sorry, I didn’t specify that. The destination can be any device with bluetooth and capable of receiving files.
I assume the file has to be readable on the receiving device.
Yes. It should be readable.
How can you be sure any bluetooth receiving device will automatically convert a base64 string to a binary file - with filename and extension ?
Thank you for making it clear. Can you suggest which would be better way to transfer a file in bluetooth from one device to other.
What I thought was to create both server and client apps.
Hi Ramesh
I’m sure in your mind you know what you want to do - but we really really do not That’s because detail matters and you have given a specification that is too vague.
Is this a school project? It’s not unusual for a teacher to set a project without understanding the consequences.
Yes Chris , its a school project. They want me to create an app through which I can send images and documents using bluetooth component only.
I didnt see any method in bluetooth component to send files.I was wondering how to implement it.It would be helpful if I can get some idea on how to do it.
OK - Google designed Android to take care of file exchanges between devices. This makes sense if you think about it - what if you had ten Apps on your Android device? All ten would have to be able to send files if the OS didn’t do it. The analogy in the PC World would be the humble printer. You might have 10 programs that need to print on paper, but you don’t have a printer for each individual program.
So, with Android, Users create files with their Apps, then they use their device to send (share) those files, managed by Android and sent by any means available, including bluetooth, that is compatible with the receiving device. That’s the normal.
Therefore, if you are to design an App that does it’s own sending via Bluetooth, it is imperative to know what it is sending to, because all devices and computers and OSs are different and there are different versions of Bluetooth too, with the collection of differences ranging from minor to major. It’s especially difficult to send a file without needing to provide software for the receiving end too.
“It’s especially difficult to send a file without needing to provide software for the receiving end too.” - For this I thought of creating another app for the receiving end. Thus two apps Sender app and receiver app.
So does this mean the device receiving the file is also Android based?
@Taifun has this example for a chat between two Android Bluetooth:
https://puravidaapps.com/btchat.php
I did this tutorial in Spanish a long time ago to send a text file from one Android to another, a mobile is Server and other Client.
http://kio4.com/appinventor/9D_bluetooth_enviar_archivo.htm