Hello,
In the previous version of my Android app, I’m able to open PDFs that are stored on a website. Users click a button, and the PDF is retrieved. I’d strongly prefer to bundle the PDFs with the app, so users can open the files without being online. In the current version of my app, I’ve saved copies of the PDFs in the StreamingAssets folder. According to this documentation, I need to use UnityWebRequest to access these streaming asset files directly on Android. I can’t figure out how this is supposed to work, and the examples I’ve found haven’t been too useful. Would anyone have a solution or guidance?
My code looks something like this. It works on desktop, but not on Android. The user presses a button in the app, which calls tryCoroutine:
public void tryCoroutine(string filePath){
StartCoroutine(openFileOnAndroid(filePath));
}
private IEnumerator openFileOnAndroid(string filePath) {
UnityWebRequest www = UnityWebRequest.Get(filePath);
yield return www.SendWebRequest();
Application.OpenURL(www.url);
}
The string filePath would be Path.Combine(Application.streamingAssetsPath, fileName);
–Thanks