# How to read file on android?

**URL:** <https://forums.unrealengine.com/t/how-to-read-file-on-android/81634>\
**Category:** Mobile\
**Tags:** unreal-engine, Android\
**Created:** [December 30, 2016, 9:15pm UTC](https://forums.unrealengine.com/t/how-to-read-file-on-android/81634 "2016-12-30T21:15:33Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![JLBXB3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JLBXB3](https://forums.unrealengine.com/u/JLBXB3)\
**Post date:** [December 30, 2016, 9:15pm UTC](https://forums.unrealengine.com/t/how-to-read-file-on-android/81634/1 "2016-12-30T21:15:33Z")

</div>

I can’t figure out how to read a file from android. The file itself will have a single char either 1 or 0 and it’s location is at “sys/devices/13400000.pinctrl/gpio/gpio24/value” Nothing I’ve tried has worked please I really need a short code example.

---

<div class="post-metadata">

**Author:** ![ZkarmaKun](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zkarmakun/32/1194545_2.png) [@ZkarmaKun](https://forums.unrealengine.com/u/ZkarmaKun)\
**Post date:** [December 31, 2016, 1:16am UTC](https://forums.unrealengine.com/t/how-to-read-file-on-android/81634/2 "2016-12-31T01:16:24Z")

</div>

Hi JLBXB3, try using:

```auto

FString data= '''';
FFileHelper::LoadFileToString(data,*yourPath);

```

and set read write permission in the project settings

---

<div class="post-metadata">

**Author:** ![ZkarmaKun](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zkarmakun/32/1194545_2.png) [@ZkarmaKun](https://forums.unrealengine.com/u/ZkarmaKun)\
**Post date:** [December 31, 2016, 1:49am UTC](https://forums.unrealengine.com/t/how-to-read-file-on-android/81634/3 "2016-12-31T01:49:49Z")

</div>

however I read your other post about read GPIO Inputs, Unreal Engine AFAIK do not own any way to read GPIO directly, but you can access it by JNI, but first you will need know about UPL system, which allow you modify the GameActivity.java directly and add your own Native function, check this post for JNI and Java mods, [[Plugin] Android Camera - Engine Source & GitHub - Unreal Engine Forums](https://forums.unrealengine.com/showthread.php?117571-Plugin-Android-Camera) and see this example I found for GPIO read through JNI ahttp://android.serverbox.ch/?p=972 and  
[http://stackoverflow.com/questions/14846765/how-to-acess-system-file-using-jni](http://stackoverflow.com/questions/14846765/how-to-acess-system-file-using-jni)  
Seems relatively simple, but who knows, if I’m wrong somebody correct me

---

<div class="post-metadata">

**Author:** ![JLBXB3](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@JLBXB3](https://forums.unrealengine.com/u/JLBXB3)\
**Post date:** [December 31, 2016, 1:40pm UTC](https://forums.unrealengine.com/t/how-to-read-file-on-android/81634/4 "2016-12-31T13:40:18Z")

</div>

Yeah I’m struggling to grasp this still. If this is easy for you I would be willing to pay some money to save me some time, but I’ve spent days on this and I’m about to go crazy trying to figure this out haha.

---

<div class="post-metadata">

**Author:** ![ZkarmaKun](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/zkarmakun/32/1194545_2.png) [@ZkarmaKun](https://forums.unrealengine.com/u/ZkarmaKun)\
**Post date:** [January 2, 2017, 6:26pm UTC](https://forums.unrealengine.com/t/how-to-read-file-on-android/81634/5 "2017-01-02T18:26:33Z")

</div>

Yes I want to try, why not, but right now I m on my vacations, I will back in 2 weeks, sorry mate

but I’m sure over here, somebody can help you

---

<div class="post-metadata">

**Author:** ![Chris\_Babcock](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Chris\_Babcock](https://forums.unrealengine.com/u/Chris_Babcock)\
**Post date:** [January 3, 2017, 8:51pm UTC](https://forums.unrealengine.com/t/how-to-read-file-on-android/81634/6 "2017-01-03T20:51:27Z")

</div>

If you can access this as a file, you can just use fopen("/sys/devices/13400000.pinctrl/gpio/gpio24/value",“rb”) in C++ on Android to do this.

Otherwise, you may want to use JNI to talk to the Java interface. I’m thinking this is what you want: [https://developer.android.com/things/sdk/pio/gpio.html](https://developer.android.com/things/sdk/pio/gpio.html)

---

<div class="post-metadata">

**Author:** ![PaYo](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@PaYo](https://forums.unrealengine.com/u/PaYo)\
**Post date:** [October 29, 2024, 8:35pm UTC](https://forums.unrealengine.com/t/how-to-read-file-on-android/81634/7 "2024-10-29T20:35:52Z")

</div>

anyone found an answer my app crash on oculus on victory use
