Search Unity

Download and hide file on android

Discussion in 'Scripting' started by Homeak16, Jan 5, 2018.

  1. Homeak16

    Homeak16

    Joined:
    Feb 27, 2017
    Posts:
    19
    Hi,

    i'm working in Unity 5.6.0 at a system for android, what at first launch is downloading some files (a .txt and 4 .mp4).
    After this my app will use those files. At second launch, app will load files, not downloading.

    Saving files is made by get Byte[] from server and File.WriteAllBytes after.
    My problem is, that i don't want to give user any access to those files.

    How can i save files in a game directory and hide them from user?

    Thx.
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,187
    The basic answer. You can't. You can encrypt your files, but it's a file on their device. If they want access to it, they get it. If it's encrypted, at least your average user can't do much with it.

    The only thing you can try is to add a . in front of the folder name. So if you save to persistentDataPath for example, you could create a folder called downloads in there, but name it .downloads instead. This will set the folder to hidden. However, if the user turns on hidden folders and files on their Android device, they could still potentially access it.
     
    MaxGuernseyIII likes this.