Trouble with FilePickers in Unity Hololens development - unity3d

I found a terrific reference on how to get started with file pickers. But with that being said, I am not able to get the provided code working for my Unity Hololens app.
My scenario:
I've a file, lets say an object file, like such, 3DModel.obj. I want my app to be able to locate this file (3DModel.obj) at runtime, and then load it at runtime.
I'm attempting to use these read/write functions but I'm getting no where. I've run through numerous functions such as, Windows.Storage.ApplicationData.Current.RoamingFolder, KnownFolder, LocalFolder, dataPath, persistentDataPath.
I've perused through Microsofts file picker documentation, and I'm still left scratching my head.
None of these seem to accomplish what I'm trying to do, or my ineptitude and lack of knowledge on how to use file pickers fails to get the job done.

Limitations of the HoloLens shell:
File Explorer and Local File System
The Windows Holographic app model does not currently expose the concept of a file system. There are known folders, but there is no built in, local File Explorer app like on Windows Desktop or Mobile. Apps can save files to their local state folders. Apps can also save files to a registered File Picker app like OneDrive.

Related

How to open file with a Flutter app on MacOS/Windows?

I have an app that should open certain file types. From the app itself, it's quite straightforward with file_picker plugin. But how to open a file trough the file manager? In other words, trough the "Open with" context menu.
I tried checking the arguments passed to main, but they are always empty. Registering a universal link wouldn't make much sense either since I only need to pass the file - nothing more.
The Mac problem is related to the fact that the development sandboxes your program. I encountered a similar problem and tried to summarize it on
Entitlement issue
you can find the setting in the entitlements (debug and release) at
<key>com.apple.security.app-sandbox</key><true/>
if (await canLaunch("file://..path...xlsx")) {
await launch("file://..path...xlsx");
} else {
print("cannot launch url ]:");
}
this simple snippet basically works both on windows and mac os! If you can deal with path with classic path_provider, you'd be able to use the same feature on web, ios, android also. In my test, web downloaded the file when i typed and entered the file:// url.
So, i guess the uri scheme is the one who does these tricks. I tried a few types of files and as i commented, excel works just fine and the finder(or file explorer) also work. In my test, pptx even worked with the file url. Yes, it opens the native app. I couldn't have found out "open with.." option, but it meant that it automatically open xlsx file in excel(ie. ATM i don't have any option to launch "open with.." pop-up tho).
Similarly, i could have even found that instagram:// also works with url launcher. One thing unexpectedly tough was to set a proper path on mac os desktop. Since the app is being debugged somewhere assigned previously by Mr. Apple, simply calling methods from path_provider returned a path far away from desktop path, the home screen, since the app is running on somewhere else(like /Users/${MacOsUser}/Library/Containers/${fullPackagePath}/Data/Documents for mac os, which would be different in the distribution stage).
Hope this would help. FYI, i couldn't launch battle.net and league of legends with this method, which don't show their extensions in the file explorer ]: Have a wonderful day [:

Unity Build - Standalone file

I have made a Unity build and would like to share it with colleagues.
But i dont want to share it as the standard "folder structure" -build.
So, I have made a single .exe file with an icon, using Winrar selfextracting file.
It works great....BUT Windows and antivirus apps screams bloody murder when they try and open it, thinking it is a potential virus of course.
That makes the file unusable for web sharing (Sharing on a USB drive there are no problems).
How can I make a single file build, for web download, that does not make Windows and Antivirus apps go crazy?
Basically...
You need to pack(age) the build of the app.
(Note the boxing app in the linked tutorial is just an example. There are many ways to pack the game into an executable, and you don't need that specific one.)
Depending on platform, it's also either required or recommended that you sign (1)(2) the app and/or executable.
That's not that trivial since antivirus hate selfextracting exe files ;)
Either go with the usual folder structure and ship it as a .zip.
Or you could go the correct but more complex way and create a proper Installer that correctly asks for admin permissions and then is allowed to extract content into the usual program paths.
Or you can try and use this but it might underly the same issue as the selfextracting exe.

Packaging a GWT app to run completely offline NOT installed via a "marketplace"

Theres a few questions similar to this, so I'll try to be clear as possible.
We have an existing, fairly large and complex, GWT webgame I have been asked to make work offline. It has to be offline in pretty much the strictest sense.
Imagine we have been told to make it work off a CD Rom.
So installation is allowed, but we cant expect the users to go to a Chrome/Firefox store and install it from there. It would need to be off the disc.
Likewise, altering of the browsers start-up flags would be unreasonable to expect of users.
Ideally, it would be nice if they just clicked a HTML file for the start page and it opened in their browsers of choice.
We successfully got it working this way in Firefox by adding;
"<add-linker name='xsiframe' />"
To our gwt.xml settings. This seems to solve any security issues FF has with local file access.
However, this does not solve the problem for Chrome.
The main game starts up, but various file requests are blocked due to security issues like these;
XMLHttpRequest cannot load file:///E:/Game%20projects/[Thorn]%20Game/ThornGame/text/messages_en.properties. Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, https, chrome-extension-resource.MyApplication-0.js:34053 com_google_gwt_http_client_RequestBuilder_$doSend__Lcom_google_gwt_http_client_RequestBuilder_2Ljava_lang_String_2Lcom_google_gwt_http_client_RequestCallback_2Lcom_google_gwt_http_client_Request_2 MyApplication-0.js:34053
Now I was aware same origin policy issues might popup as during development we often tested locally using flags in chrome to bi-pass them.
Thing is...now I dont know how to get around them when we cant use startup flags.
Obviously in the example given its just the .properties file GWT uses to get some language related text. I could dump that inline in one way or another.
However, its only one of many,many,many files being blocked.
The whole game was made to run off *.txt game scripts on the sever - to allow easy updating by non-coders. Really the actual GWT code is just an "engine" and all the XMLHttpRequested files supply the actual "game".
These files are of various types; csv, txt, ntlist, jam.
The last two being custom extensions for what are really just txt files.
All these files are blocked by chromes security. It seems from what I can make out only images are allowed to be accessed locally.
Having all these files compiled in would just be impossible, as they are not fixed in number (ie, one central .txt file determains various scene .txt files which in turn determain various object files and directory's...).
Putting all this into a bundle would be nightmare to create and maintain.
So in essence I need some way to supply a offline version of a GWT project that can access a large number of various files in its subdirectories without security issues.
So far all I can think of is;
A) Theres something I can tell chrome via html or gwt that allows these files to be read in Chrome like FF can. (I suspect this isn't possible).
An alternative to XMLHttpRequest maybe?
B) I need to somehow package a game+a webbrowser in a executable package that has permission to access files in its directory's. (http://www.appcelerator.com/titanium ? ?? ).
C) I need to package and have the user run a full webserver that can then deliver all these files in a XMLHttp accessible way.
D) Bit of a funny one...we cant tell the user to add flags to browser start up...but Maybe I could write a game installer which just detects if they have Chrome or Firefox. It then opens up the games html in their browser with the correct flags for them? This would open up security issues if they browse elsewhere with that instance though, so Id presumably need other flags to disable the url bar if that's possible.
I am happy to make various changes to our code to achieve any of this - but as mentioned above theres no way to determain all the files needing to be accessed at compile time.
And finally, of course, it all has to be as easy as possible for the end user.
Ideally just clicking a html file, or installing something no more complex then a standard windows program.
Thanks for reading this rather long explanation, any pointers and ideas would be very welcome. I especially will appreciate multiple different options or feedback from anyone that's done this.
========================================
I accepted the suggestion to use Chromiumembedded below.
This works and does what I need (and much much more)
To help others that might want to use it, I specifically made two critical changes to the example project;
Because CEF needs a absolute path to the web apps local html, I wrote a c++ function to get the directory the .exe was launched from. This was a platform specific implementation, so if supporting a few OS's (which CEF does) be sure to write dedicated code for each.
Because my webapp will make use of local files, I enabled the Chrome flag for this by changing the browser settings;
browser_settings.file_access_from_file_urls = STATE_ENABLED;
These two changes were enough to get my app working, but it is obviously the bare minimum to make a application. Hopefully my finding will help others.
I'd suggest going the wrapper route. That is, provide a minimal browser implementation that opens your files directly. Options are Chromium Embedded[1]. If the nature of the application absolutely requires the files to be served as non-file urls then bundle a minimal webserver, have the on-disk executable start the server and open the bundled browser with whatever startup arguments you want.
[1] https://bitbucket.org/chromiumembedded/cef

How to make Custom Application to persist reboot of WinCE 6.0 OS?

I am looking for a solution on how to setup the Windows CE 6.0 design image to integrate my custom application.
I want after building the image and starting it on the target machine to be able
to access my application from the \Hard Disk\Program Files\CustomApp folder.
In addition I require the application to be persistent. It must not be lost after reboot.
I am aware of copying the application to the Hard Disk out of the NK.BIN but if is possible I want a solution like adding dlls or other files to Windows folder.
I am usign an SQL CE database along with the application so I want the data to be persistent too.
Thanks in advance.
If the \Hard Disk folder contents are not persistent (and I assume they aren't since you're asking this questions), then getting the app to "persist" can be done only as a slight-of-hand trick, just like the contents of the Windows Folder. At boot, the OS will get expanded into RAM, and if you've included your app in that OS, it will get extracted too.
First, you must include your app files (exe, dlls, all dependencies, etc) into the OS image by adding them to a BIB file.
Next, you must understand that all files get extracted to the \Windows folder. There are no exceptions. If you want it in a different folder, you must use a DAT file to tell the OS where to put it one the OS has been extracted. Be aware that the DAT file does a copy, not a move, so if you want it elsewhere, you'll have two copies of the app on the device. A typical solution is to use the DAT file to place a shortcut, not a full copy.
The last part of your question is the hard, or maybe impossible, part. Your database is not going to persist. You could include a copy in the OS, but every time you hard reset, a new copy of the database as it was when the OS was built will get copied out. No new data will survive.
To get that to work, you need a persistent file store on the device. If you're the OEM, you might be able to implement one with any remaining on-board storage (where the OS image file resides) or with separate mounted USB/CF/SD/HDD media. How you do this is highly hardware and BSP dependent, plus it's way more complex than can be described here on SO.Without knowing anything about the target device, it difficult to even give you any pointer on where to begin. Here's a very generic starting point for Flash storage.

Is there an API or any other method to automate the submission process?

I have a number of apps which are similar in functionality and UI. I create the user interface by picking up variables from a .plist file. For instance, I save the source of the API from where I pick up the data.
Creating a new app involves just changing the values in the .plist file and rebuilding the app, and finally submitting it to the App Store. Also, I need to create Ad-Hoc provision files and build test releases too.
I wish to automate this process. For this I need to:
Build the app through the command line interface.
Upload the binary and other required files/information (app icon, description, etc.) to iTunes Connect.
Any pointers where I should look?
It's 2016, and now we have the iTunesConnect Transporter command line tool with a quick start guide here.
Also, have a look at this OSS project that wraps the Transporter tools (and others) in a friendly way:
https://fastlane.tools
Building your Xcode projects can be automated by using the command line tool xcodebuild that Apple provides.
As far as automating the app creation process goes, Apple has not exposed this functionality outside of the Xcode GUI. You can still automate this and there are two options.
Use Automator to create a script
that replays all the actions a human
would perform to create a new
project. Parts of this replay
script like the project name etc.
can be customized and
programmatically fed to the script.
A disadvantage of this method is
that this will actually run on the
GUI and will be slow.
If you want to do it all through the
command line, you will have to
reverse engineer the contents of the
Xcode project file that has the
extension .xcodeproj. It's a
compressed file and contains a few
XML configuration files for the
entire project. There is no public
documentation on the contents of
these XML files.
For automating the submission process, you will need a script that talks to itunesconnect.apple.com. This is where you would submit your app to the App Store. Checkout this page for more info on iTunes Connect.
A browser automation tool will be helpful here though you could roll your custom script that talks to iTunes Connect over HTTP.
To summarize, the only thing that can be used readily out of the box is the xcodebuild tool. Everything else has to be reverse engineered.