Mihail5412 / Unity-Android-Files-Opener

Allows your unity android application to open files on local drive
MIT License
18 stars 4 forks source link

Unity-Android-Files-Opener

Unity Android Files Opener allows your android application to open files on local drive with (including API Level 24 or higher). If you encounter a problem on Android Application.OpenUrl does not work, then this will solve your problem!

Requirements

Unity Editor 2017 or newer

Installation

Add Assets files to your Assets in Unity project.

Usage

The following example demonstrates how to open a file:

public void Example()
{   
    string dataType = "application/pdf";
    string documentUrl = "/storage/emulated/0/Test Folder/template.pdf";
    AndroidOpenUrl.OpenUrl(documentUrl, dataType); // you can specify any MIME type when opening a file by explicitly specifying the dataType parameter
}

The demo project creates the "Test Documents" folder in /storage/emulated/0 and you need to allow external write permission. Open Player Settings in your project and change Write Permission to External(SDCard).

Known Editor errors:

Notes

License

This project is licensed under the terms of the MIT License.