AndroidNativeCore.AndroidFileManager

Description

This class allows you to create folders, read and write files in android internel storage.

You need to add android.permission.READ_EXTERNAL_STORAGE and android.permission.WRITE_EXTERNAL_STORAGE permissions in AndroidManifest to access files in android os check how add permissions in configuration window.

Public methods
bool makeDirectory(string path)

This methods create directorys by passing string path in internel storage and return is directory created or not as bool value.

bool isFileExits(string path)

this methods return bool value by is file exits or not in given string path.

void writeFile(string path,string child,byte[] data)

this method write file in given string path, file name as string child and byte[] as given data.

byte[] readFile(string path)

This method return file data as byte[] in give string path.

bool deleteFile(string path)

This method delete file in given string path and returns bool as result.

Example
    
using AndroidNativeCore;
using UnityEngine;
public class Android:MonoBehaviour{

/**
*Save screen shots in folder AndroidNativeCore/ScreenShots/ in device intenel storage. 
**/
    public void saveScreenShot(){

        StartCoroutine(RecordFrame());
    }
    IEnumerator RecordFrame()
    {
        yield return new WaitForEndOfFrame();
        var timestamp = DateTime.Now.ToString("yyyyMMddHHmmssffff");
        var texture = ScreenCapture.CaptureScreenshotAsTexture();
        byte[] data = texture.EncodeToPNG();
        if (!fileManager.isFileExits("/AndroidNativeCore/ScreenShots/"))
        {
            fileManager.makeDirectory("/AndroidNativeCore/ScreenShots/");
        }     
        fileManager.writeFile("/AndroidNativeCore/ScreenShots/", "screenshot-"+timestamp +".png", data);
        Toast.make("Screen shot saved on internel storage AndroidNativeCore/ScreenShots/screenshot-" + timestamp,Toast.LENGTH_SHORT);
        UnityEngine.Object.Destroy(texture);
    }


}