Search Unity

Dynamic config on Oculus Go apps

Discussion in 'AR/VR (XR) Discussion' started by Keaneo, Apr 19, 2019.

  1. Keaneo

    Keaneo

    Joined:
    Mar 7, 2015
    Posts:
    99
    Hi,
    I have an app that references an external web service. For various reasons I refer to the endpoint using its IP address but if the IP changes, I'd have to rebuild and redeploy. Any suggestions on how to solve this? I could use DNS of course (that's what it's for!) but I assume there'd be some delay while changes propagate - I need it to change immediately. Plus I could use this for a few other things too!

    i.e. could it can read the IP from a file perhaps. Or can I use adb to update some Go config value that I can then read from inside the app?

    Thanks!
     
    Last edited: Apr 19, 2019
  2. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    It's hard for me to imagine the situation where manually stuffing a file onto your Go, or using adb, would be preferable to just waiting for the DNS change to propagate. But if this really is a local-device sort of thing, you might just do the mapping on your WiFi router, using its admin tool. That updates instantly.

    If that still doesn't work, and you also don't want to have an IP address entry UI in the app itself, then yeah, reading from a config file is probably easiest.
     
  3. Keaneo

    Keaneo

    Joined:
    Mar 7, 2015
    Posts:
    99
    Hi,
    Yeah it's not ideal - but I'll need to setup for quick demos which involves connecting two Go's and a laptop (hosting the webservice) to the same network, or even an iPhone and give a demo. So the IP change would kill it as would waiting for DNS.

    Are there any examples of reading a config on a Go? Maybe it's just plain "file system" stuff and I just get the path and read a text file?

    Thanks for the feedback!
     
  4. JoeStrout

    JoeStrout

    Joined:
    Jan 14, 2011
    Posts:
    9,859
    It is indeed plain C# file I/O. You get (or create, if it doesn't already exist) a directory like so:

    Code (CSharp):
    1.         System.IO.FileInfo dirFileInfo = new System.IO.FileInfo(Application.persistentDataPath);
    2.         dirFileInfo.Directory.Create();        // (does nothing if the directory already exists)
    3.  
    and then access files within that directory using standard System.IO stuff. This appears on the device under Android/Data/app-id/files, as illustrated here.