- Home /
Saving jpgs on android silently fails
I am attempting to create an app that will generate reports. The plan is to house all the supporting report documentation in each report folder.
I am able to save csv, xml, and wav files in something like Application.persistentDataPath + "/Totaly_random_report_folder_name/"
However, jpg's will simply fail silently unless I specifically save them in a /Screenshots/ folder. Here is the code that works:
using (var fileStream = new FileStream(Application.persistentDataPath + "/Screenshots/" + imageName, FileMode.Create))
{
byte[] bytes = curPhoto.EncodeToJPG(75);
fileStream.Write(bytes, 0, bytes.Length);
}
Is there any reason why I can't save jpg files to a folder other than "Screenshots"?
Thanks,
Jon
I do actually get an error. Here is the info from logcat. Looks pretty useless to me:
08-01 09:25:25.269: E/Unity(31709): at UnityEngine.Events.InvokableCall.Invoke () [0x00011] in <032707c4280f488db0a279a77d41ab9e>:0 08-01 09:25:25.269: E/Unity(31709): at UnityEngine.Events.UnityEvent.Invoke () [0x00023] in <032707c4280f488db0a279a77d41ab9e>:0 08-01 09:25:25.269: E/Unity(31709): at UnityEngine.UI.Button.Press () [0x00027] in <9bb8f6e40006490da4518a3cf5afe42e>:0 08-01 09:25:25.269: E/Unity(31709): at UnityEngine.UI.Button.OnPointerClick (UnityEngine.EventSystems.PointerEventData eventData) [0x00011] in <9bb8f6e40006490da4518a3cf5afe42e>:0 08-01 09:25:25.269: E/Unity(31709): at UnityEngine.EventSystems.ExecuteEvents.Execute (UnityEngine.EventSystems.IPointerClickHandler handler, UnityEngine.EventSystems.BaseEventData eventData) [0x00008] in <9bb8f6e40006490da4518a3cf5afe42e>:0 08-01 09:25:25.269: E/Unity(31709): at UnityEngine.EventSystems.ExecuteEvents.Execute[T] (UnityEngine.GameObject target, UnityEngine.EventSystems.BaseEventData eventData, UnityEngine.EventSystems.ExecuteEvents+EventFunction`1[T1] functor) [0