How to read file on android?

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.

Hi JLBXB3, try using:




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


and set read write permission in the project settings

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 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
Seems relatively simple, but who knows, if I’m wrong somebody correct me

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.

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

1 Like

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