Better path_provider - flutter

just wondering if there is any way to access files on the system. not just the directories provider by path_provider?
seems like this should be part of core flutter, or at least a package. maybe most flutter apps don't require files from elsewhere (or maybe most apps in general, I'm just starting out)
I want to scan the file system for audio files. I know I could do it in android, as I made a little demo app to try some things with native code

The issue is that each platform is very much different, both in what you're able to do and how files are arranged.
The path_provider does actually have a way of getting the external files directory: getExternalStorageDirectory. However, that only works on Android as iOS doesn't allow reading files outside the app's sandbox. But once you use that you can use dart:io's File and Directory classes to read the files.
You also need permission on android to be able to read files. Putting this in your manifest should do it, but there's tons of android-specific answers that will tell you more.
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Note that on iOS, there are ways to access specific types of files (i.e. pictures and videos), just no normal filesystem access.
Also note that if you've already done in android native code, you can use platform channels to interface between flutter and the native code.

Related

How to store files in directory that will be accessible to user in flutter?

I have encountered a problem that the app needs to save pdf files downloaded from the internet in the downloads folder in both ios and android, but after searching for solutions on the internet I have not found anything that would help in this implementation. I would appreciate if someone could share their experience in implementing such functionality.
It would be better if you can add more details to your questions. It is preferred that you should attach some code or screenshots of your code so that you can get better help.
every app in android or ios has its own folder in the device storage, android apps will be in the android directory.
you can use the path_provider plugin to get the directory of your app, all the information you need will be in this link

Addition of plugins to React native app without using expo and without modifiying AndroidManifest.xml and info.plist files

I would like to add plugins like camera, scanner in an react-native-app but this involves addition of some additional code into AndroidManifest.xml and info.plist file for enabling plugin permissions
Whereas I would like to add the plugins at one place and it should update in appropriate Android and iOS files, similar to that of config.xml file configuration in cordova apps.
Are there any libraries available to implement in this way ?
Thanks
Unfortunately no. Adding libraries that deal with permissions has always been a bit of a struggle in react native, where you have to touch the android and iOS files and often times specify why your app requires those permissions in the first place. It gets a bit more complicated as different android versions have different ways to deal with permissions.
The good news is that most of the libraries you'll want to add provide a detailed documentation on how to set them up properly which does not take too long after you get the gist of it.

Is it possible to Flutter apps to write on iCloud/Google drive?

I am new to flutter and am trying to figure out if there is a way in flutter to write a file to iCloud (iOS) or google drive (Android). There seem to be APIs to do this in Swift/Android native dev, but I can't find anything in a flutter.
I essentially want my app to write on a text file in iCloud so that another install of the same app on a different phone by the same user can access that file. I'm trying to do this without my own cloud setup (no firebase etc, since it's so simple and small), so I thought iCloud/gDrive would be perfect.
The icloud_storage package does upload and download with iCloud.
The googleapis package provides rudimentary support for the Drive API. You'd want to use the google_sign_in for authentication as shown here.
I looked into it a while back but didn't continue due to how young it looked.
I've got no experience with iCloud so I can't really help you there, but I think you'd need to write your own platform plugin or use an HTTP API, if one exists.
I know that I'm late to the party but there is this module
https://pub.dev/packages/file_picker
I haven't used it myself but they seem to support iCloud

write file with ionic, plug in Phone, copy away?

I've just seen that there exists a cordova extionsion to write files in ionic.
But. What am i supposed to do with it? I mean a Usecase would be "create File, Plug-in Mobile, Copy to to Computer" but this I guess isn't supported by iOS at all.
So my questions are:
What is $cordovaFile meant for in ionic?
Is it possible to to realize the above Usecase in android even though it's clearly not in iOS?
Quote from the github page:
This plugin implements a File API allowing read/write access to files residing on the device.
Maybe you would want to download an image and save it to the sd card for example (you would need filetransfer plugin to download the image). More info about the plugin you can find here.

How can i access iPhone files via Objective-c?

I noticed that there is software (such as iExplorer) that allows you to access files on an iPhone-device from your Mac.
Now my question is: How can I access iPhone files via Objective-c?
This is only for educational purposes.
I found this: https://github.com/Chronic-Dev/libirecovery but I'm not sure if I'm on the right track.
So it seems that you're looking for an API which makes it possible to access the filesystem of the iPhone from a computer. Well, this API exists, and it's called the MobileDevice framework.
Unfortunately, there's no easy or legal way to access files on your iPhone, especially through Objective-C.
The applications installed on iOS are sandboxed, which means they can only access files in their own directory tree; they have no access/knowledge of other files.
Like you said, you can access files using software like iExplorer, but not programmatically from the iPhone itself.
Here is an old project to browse the iphone. You may be able to get some pointers from it on building an application to do the same with the latest info.
http://code.google.com/p/iphonelist/
Couple that with carbonic acid's post about the Mobile Device Framework and you should be able to do some good stuff.
if I find more unique info ill post it here.