Connect Arduino uno to Android phone via OTG cable

Hello everyone,
i want to connect my arduino uno and my android phone via a otg cable. That i want to do is to sent a simple text file which is stored to the sd card(on arduino) to my android app and read it from my app as a string.
Thnaks a lot

jdiavec:
Hello everyone,
i want to connect my arduino uno and my android phone via a otg cable. That i want to do is to sent a simple text file which is stored to the sd card(on arduino) to my android app and read it from my app as a string.
Thnaks a lot

So, what's stopping you?

I dont' know how to do this. I have not find an example or something else close to my problem.

What Android app are you using ?

I don't use a specific app. I have made an application for other reason and i want to add this feature . I print on sd card a text file like this:

Timestamp: Friday 12.01.2000 -- 06:09:40
G:0.48,0.58
X:0.00,0.01
Y:-0.44,-0.53
Z:0.18,0.22,
------------------------------------------------------------------------------------------------------------------
Timestamp: Friday 12.01.2000 -- 06:09:44
G:0.48,0.76
X:0.00,-0.12
Y:-0.44,-0.71
Z:0.18,0.24,0

and i want to read this file from my android app.

I have a terminal app on my 'phone that I downloaded that communicates with an Arduino via a serial link over an OTG USB link. If you can modify your app to accept serial data the same way then transferring the contents of a file on an SD card should not be difficult.

Yes i think it will be not difficult but i don;t know how to start.

jdiavec:
Yes i think it will be not difficult but i don;t know how to start.

Do you actually need to save the data on an SD card ? Could you not just send it to your 'phone ?

If you must save it to an SD card first then write a program to read the file on the card and send it to the Serial monitor. Get that working and you will be 90% or more of the way to sending it to your 'phone.

Arduino will work all the time and collecting and saving data to the sd card. When i connect my phone i want to read these data and upload them to a site. I have already write the arduino code but i am searching for the java code .

I have already write the arduino code

Does that include the code to read the card and send what is written to the 'phone over a serial link ?

i am searching for the java code .

Then you are searching in the wrong place. It is possible that someone can help you here but this is an Arduino forum.

Have you tried asking in a Java forum ?
Forget the fact that the data is coming from an Arduino, the important thing is that you are receiving it over a serial link.

There appears to be several serial USB terminals in the Playstore, and there is the code for dumping files to serial in the IDE examples. You seem to be making this more difficult than it really is, so I won't bother asking why you are looking for something in java.