How to place a file on xamarin android device so it is available on the device and the network - xamarin.android

I've found out that
Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDocuments).AbsolutePath
gives me /storage/emulated/0/Documents, but I can't see this folder on my android device.
view of device folders
Ideally I want to be able to copy or create a csv file into a folder where it can be 'seen' by the device and the network the device is part of.
How can I create such a folder? Thank you.

Related

How to Flutter write files to iOS iPhone "Find on my phone" Folder

My goal is to allow my app user write and read files created by my app. For example, write and then allow the user to email a .CSV file of data, or a .GPX file of location data. And on the other end, import a file back into my application.
I have successfully deployed an Android version of my app (Plant List GPS) which uses Flutter plugin path_provider 1.6.10. On Android, I successfully use external directories, but this external directories solution is not available/allowed for iOS. I find on iOS I can create subfolders and write to the getApplicationDocumentsDirectory, but when I try to find/read that file from a file picker solution, it cannot be seen. I understand this is proper behavior to protect sensitive app files in this folder location.
I also understand that iOS has the concept of an app Sandbox and appreciate its objectives. I'm not trying to defeat it, but find a way to access/use it in my Flutter app. I have played around in writing test data files to various places on the iOS file system using the iPhone 11 simulator on my MacBook, but can not get any file to appear in the phone "Find on my phone" dialog.
Any help in solution approach or technique is appreciated.
I think you need to add both the keys into info.plist, and then files from your app directory will be visible on Files app!
LSSupportsOpeningDocumentsInPlace
UIFileSharingEnabled

Debugging & accessing NSDocumentsDirectory in real device

I have my apps using NSDocumentsDirectory for saving the downloads & offline data on device. From debugging point of view, I was debugging as usual on simulator & was trying to access the path for these downloads & I was able to do that. I have my doubts as :
I am not able to access the location /var/mobile/Applications/SOME-HEX-CODED-PATH/Documents/ via terminal that was shown in the NSDocumentsDirectory paths during debugging on device. Whereas in iOS Simulator I am able to open , read/ write at that location.
I am not able to browse through the /var/mobile directory as it is not listed in the finder, not even as hidden directory.
Is that directory is mounted on runtime ?
Please clarify.
I am not sure to fully understand your question. You want to access, from your laptop, the filesystem of your device?
You are not supposed to do that on a regular device at least. If you want to browse your documents directory do it through the organiser (Window/Organiser) and then "devices" tab and select your device and your app. You will be able to see your sandboxed filesystem in the bottom part and downloaded its content.

Check files in Documents, Library or tmp directory on iOS device

I am making on an app and want to get access to the directories that system create automatically when app installed on device. Of course when I use simulator I can find these directories without any problems, but how to open them on device. Maybe via iTunes or maybe Xcode has access to these directories.
The folders are below:
Why I need it:
Because after my app restore some products (iOS simulator does not support StoreKit) I have few records in the tmp folder in SQLite database.
#neilco , it's not necessary to use 3d party tools for this. In Xcode, go to organizer, select the connected device, "applications" tab, select desired application and hit "export" button below. This will export you app to your mac, so you can see your depicted folder structure, files' contents etc.
Take a look at using iExplorer as this allows you to views the folder structure of apps on a device.

Retrieve files from iOS app Documents folder via command line

For the project I work on, we have to set up performance metrics. The way we do it is that the simulator writes CSV files to a known location. We then retrieve theses files and make graphs out of it. Piece of cake.
We also have these tests running on the device. In that case, the files are created in the Documents directory.
While I can retrieve these files via the organizer, I'd be much more interested in automating that.
How can I retrieve files from an iPhone app via the command line rather than the organizer?
You can actually access the content of your app from your computer, using https://github.com/phonegap/ios-deploy (originally https://github.com/ghughes/fruitstrap) .
It's as simple as :
./ios-deploy --download=/Documents --bundle_id com.mycompany.myapp -2 dest_dir
You can do much more, like listing the content of the app, debug using lldb etc.
You can use iFuse, as part of libimobiledevice
You can not access the documents folder on your iOS device from your computer without itunes.
I run an webserver within my app so i can download the files via http. For zero configuration setup i use Apples Bonjour.
look here:
https://github.com/robbiehanson/CocoaHTTPServer
https://developer.apple.com/bonjour/

Get data from user test on device to mac

I'm doing some user tests of my new iOS app and store some test data in a plist. When I do that in the simulator it is easy to get that file for further analysis on my mac, but how can I easily get it from a real device? This will only be used during testing and will not be part of the final version.
Possible ways I have read about but not tried (in hope to get some directions here first):
E-mail attachment
Enable file transfer to iTunes
Jailbreak (but don't want to)
Currently what I am doing is to NSLog it and copy and paste from Xcode into Excel, but this requires that the device is tethered to my mac.
Any experience or advice on easiest way to get this done?
I sometimes use iPhone Explorer to do this, because the plist file I want is not in my Documents folder. I use it to navigate to the files associated with my app on the device. Just connect your device to your laptop, run iPhone Explorer and then use it to locate the plist file you want and drag and drop it wherever you want.
You can save data from Organizer. Just click on your device and it'll show in right pane. Files from documents folder and possibly other folders can be saved.

Resources