IsolatedStorage on Mono for Android - webview

Where exactly is the IsolatedStorage on the android devices. I would have expected it to be in the /mnt/sdcard/Android/data/[packagename]/ location, but it is not. I used the File Explorer (from eclipse) to try and find it, but I can't.
If I can somehow load a html page into the WebView or play a video from IsolatedStorage, then I won't need this actual path. But, I don't want to copy the movie to a temporary location in order to play it, I might as well just store it on the SD Card.
The reason I am using IsolatedStorage is to minimize the custom code across the platforms, I am developing for the Windows Phone, which only allows for IsolatedStorage.

To determine the directory in which your "isolated storage" aka internal storage is kept, use the GetFilesDir() method. This method is part of the Activity base class. It is to be used for files you do not want other applications to have access to.
Other useful methods
GetFilesDir():
Gets the absolute path to the filesystem directory where your internal files are saved.
GetDir():
Creates (or opens an existing) directory within your internal storage space.
DeleteFile():
Deletes a file saved on the internal storage.
FileList():
Returns an array of files currently saved by your application.
See the android developers documentation for more details

I found that IsolatedStorageFile points towards internal memory only.
I used the Context.GetFilesDir() and the Context.GetExternalFilesDir() depending on the user's selection.

Related

Document Renaming with UIDocumentBrowserViewController

I am using the "new way" of storing documents (iOS 11+) using UIDocumentBrowserViewController. No need for iCloud API, Entitlements etc. -- just works (under control of the separate Document Browser process).
However, I haven't figured out how to rename (i.e. move) a document programmatically this way, at least within iCloud. The standard "url.setResourceValues()" does work just fine on the local filesystem, but renders in 513/not permitted in iCloud. Also all the former ways of doing it (using full set of iCloud capabilities & entitlements, using complex FileCoordinator orchestration etc.) don't work either when the created document actually is controlled through the document browser.
I couldn't find any reasonable documentation or example on how to use the UIDocumentBrowser to also move a document under it's (and somewhat my) control. There is the UIDocumentBrowserImportModeMove mode that might do what I need, however I have no clue how to programmatically initiate that on a given UIDocument.
Has anyone already made experiences to do it this way?
Thanks, habitoti
There is no API to move a document that was returned to you by the document browser after the user picked it. You should file a bug with Apple to get one.
If this is inside your iCloud container, you can use the iCloud entitlements and -[NSFileManager URLForUbiquityContainerIdentifier:] to get sandbox access to your container and do whatever you want inside with NSFileManager; but that won't work in iCloud outside of your container or in other file providers (Dropbox...).

WKWebView File System Browser

I've been asked to add a file browser to an existing Objective C application that uses a WKWebView to load up a Javascript internal app.
Currently we have the capability of looking at the pictures on device to upload images into the app, but I've now been asked to do the same with more generic file types, specifically PDFs.
What I've read so far is that this is only possible if a file is stored in a specific part of the file system and only if the app knows exactly where the file is to begin with, but what I need is the capability to browse to a certain degree.
What I'd like to know is whether this is possible and if there is a good place to start on that?
Thanks.

What is the safest directory in iOS which can be used to download images/pdfs? [duplicate]

Currently i was saving my application data (Media) to the CacheDirectory i.e
/var/mobile/Applications/BEAFC76C-C450-4A3A-9765-A0385A9580F3/Library/Caches
and things were going fine. But recently i got a bug report that the application data has been deleted. When i searched over it, i got this Apple Doc. According to it, DocumentsDirectory should be the ideal place to store the User/Application data.
Put user data in the /Documents/. User data is any
data that cannot be recreated by your app, such as user documents and
other user-generated content.
And Cache should not be used to store the User Data that could not be reproduced by the application.
Put data cache files in the /Library/Caches
directory. Examples of files you should put in this directory include
(but are not limited to) database cache files and downloadable
content, such as that used by magazine, newspaper, and map apps. Your
app should be able to gracefully handle situations where cached data
is deleted by the system to free up disk space.
What should be the ideal place to store it.
EDIT:
I have an application that allows user to store Videos and Photos in the application. For that i used CacheDirectory. But i am getting bug reports that the Data (Videos/Photos) is getting deleted. What conclusion i draw is that the data is being getting delete by the Device itself in order to provide space.
Secondly i also wanna give the iTunes sharing function. So only the particular files has to be stored in the DocumentsDirectory. Some files can never be exposed and some has has to be shared. What should be the ideal way to store the files.
Use Documents (NSDocumentDirectory) for files you wish to share via iTunes.
Use Application Support (NSApplicationSupportDirectory) for files you wish to hide from the user but still be backed up and never deleted by the OS.
Starting iOS 5, Apple says that it's no longer a good thing to save all kind of files in Documents Directory - if you do that, your app will be rejected for sure because this folder is backed up to iTunes & iCloud, unless otherwise specified.
It says that we should save files into Caches or Tmp Directory - these won't be backed up, but it's not a good thing to do because files from these directories can disappear if low memory happens.
So I think the best think to do is to save the important files that you need all the time in your app into Documents Directory and mark them not to be backed up, like this.
Library/Application Support Folder is the folder you should be using.
This directory doesn't always exist, and thus you may need to create it.
You can enable or disable whether you want to backup this data with iTunes or not.
This data is not accessible even if you enable file sharing. Only data that you put in Document directory would be shared with iTunes sharing, so you can still protect your data and get it backed up as well. Apple's documentation

Save files in wp7 in a location other than IsolatedStorage

I have a WP7 application which downloads some files from a server. Now I am saving these files to isolated storage. Is there any option to save these files in a location other than Isolated Storage. No problem for accessing these files from outside the application.The reason is that I need to open these files and show them to the user.
Is there any option to store outside Isolated Storage? If yes, how?
These are the ways you have to persist information in Windows Phone:
Save to a file in Isolated Storage (with the IsolatedStorageFile)
Save in the Application Settings (with the IsolatedStorageSettings)
Save to a database (that will be in turn saved in Isolated Storage)
Send the info to some Internet webservice/remote storage
If it is a picture file, you can save it to the Pictures Library (with the MediaLibrary - sample)
There is no other access to storage in Windows Phone right now!

Where in the filesystem do I store app's data files?

I need to store some data files for my blackberry app. These are usually small png files that I download and store locally for performance reasons. Also I need to store an xml file locally.
My question is where are these files supposed to be saved on a blackberry? Is there such a thing as an application's home folder or settings folder in the blackberry filesystem?
What would be the path to such a folder?
This is for blackberry os 4.7 or later.
Thanks!
If it's not a huge amount of data (and by the sounds of it, it's not), take a look at the PersistentStore mechanism. You can store many types of data including native types (String, Integer, etc.) and even byte[] data (for images) using PersistentContent. The nice thing about PersistentStore is that it doesn't require any sort of filesystem access -- it doesn't leave files hanging around -- and if you include a custom class in the persistent store for your app (even a simple subclass of an existing persistible class such as Hashtable), it will automatically delete your persisted data if the app is deleted.
There's no official home folder for your application. In blackberry you can basically read/write just about anything/anywhere (well, you might get a SecurityException/IOException if you'll try do change some files).
You can write to the SDCard/Internal memory using the paths described here.
If you're worried about someone seeing and altering your data there's not much you can do except setting your files and directories as hidden using FileConnection.setHidden(true) but this is very lame since they can still be seen even from the native BlackBerry file browser if the user chooses to show hidden files from the menu.
Edit: You could of course encrypt/decrypt your data but this won't prevent someone from deleting it.

Resources