Xamarin.Forms - Best way to open dialog to search file - android

I created an little application in Xamarin.Forms to get the images in my file with XLabs. It work with android and IOS.
But now, i want to import file and i search the best plugin to do that.
I found this : https://developer.xamarin.com/recipes/android/data/files/browse_files/
But it dosent exist with IOS. And i don't know if it's possible (to search and get file)
And it's why i come here, to get answers.
Can you give me a plugin or a solution to get file/path of any file with OpenDialog, intent, or page custom
Thank you

Are you wanting something that can search files outside of your app's directory on iOS or only files within the app's directory?
If you want the former, iOS severely restricts this kind of thing, unlike Android. So it is not possible to do the same thing on iOS that you can do on Android.
Look at the second paragraph here and see that the app is sandboxed which means it cannot view files outside of it's own directories.
That being said other apps can make files available to be shared with other applications, see here.
You can also get access to other files from the device's iCloud account. See this for pre-iOS 8 and this for post iOS 8.

Related

Sharing Config Files Across Apps - Android 10 and Beyond

My company has three different Android apps that provide functionality for sales reps. We opted to separate the apps into "modules" because not all reps need all the modules. Up to now we have been using a JSON file in a directory on the SD card of the devices to set some configuration data for the apps. However, it appears that with Android 10 and beyond this will no longer be possible.
Currently we use getExternalStorageDirectory() to access the SDCARD and then open a file inside a directory our app creates.
Since we want the file access to not be something the sales reps have any control over we want it to happen transparently. However it does not seem this will be possible going forward.
Will using a custom FileProvider or even a DocumentsProvider be a way to continue to share data between our apps?
Another question, although not as important, is, can we change the default location of the DB files our app creates as we do now in earlier versions of Android?
Thanks
Rich

How do i stream files from a website to my app?

I feel like 'stream' isn't the right word for it but how do i, let's say on my website i have jpg/mp3 files and i want to get these said files and make them appear in my android app.
Okay so... 1.) I set up a site then upload files there.
2.) then somehow retrieve files from said site to my android app.
3.) Play mp3's hence 'stream' do i put these files(jpg/png/mp3/mp4) on a sql database? then access it from the application? that's only method i could think of but i would like to know if there's another way to do it.
Oh and a the site i mentioned is where i just upload these files, so i plan to put a search bar on my app then if someone searches "soccerball.jpg" for example then it'll grab the file from the site then make it appear on the app.

Android APK using external data

Hi i am looking into an android development , as we all know when we build the project it makes an APK that is the whole program. but is it possible to make a an android project / APK that would be able to use external files to include more info into the project.
like say for example i have a list commands or functions in my list , but i dont want it to be added into my APK build , is it possible to use it externally?
i was curious because something like COC and other games after downloading it , then downloads extra data from the net , more into updates for the whole game.
how is this possible or is it possible to do , and use functions or source codes externally and not include it into the APK , and also the proper usage of it
Any Android App can connect to the Internet and save downloaded data files to use as they need, without requiring to include them inside the APK. Indeed, for many games (and other Apps having large data sets), it's a sensible option.
There are a couple of things to be aware of:
Android restricts where (on the filesystem) you can save files. And no matter where you save the files, the user can delete them at any
time. Your App should be able to cope with this.
The files should only ever be data files - not executable code. Attempting to
execute downloaded files is likely to put your users at risk
(depending on the permissions your App was installed with) and is also likely to get your App marked as malware.
You should read the Android documentation on Data Storage to learn a bit more about it.

open specific files from within android app

As part of an app I'm writing, I need an ability to look for specific files, like .doc or .rtf, from within the app. After finding them, the app will store their adress or something like that, so that they could later be opened when necessary. The app wouldn't open them itself, it will use a different app for that. So, all I'm looking for is a way to browse for those files from within my app.
As i understand you need to find files with given extension. For this approach you can use FileFilter. Check this answer.

Android SDK - Open any file I want?

According to the Android Development Documentation, you can't just open any file you want ("Open a private file associated with this Context's application package for writing.").
What, however, when I want my application to read files created by other applications? Let's say I have a file in /data/app_1/hello.txt, but my application has nothing to do with it because my app is called app_2, how would I still be able to open this file (and write back to it)?
You can't in general, Applications on Android are isolated and sparated. A application can only write and read its own files.
There are exceptions: As the documentation states: "It's possible to arrange for two applications to share the same Linux user ID, in which case they are able to access each other's files. To conserve system resources, applications with the same user ID can also arrange to run in the same Linux process and share the same VM (the applications must also be signed with the same certificate)."
Another possiblity is that the files are created as "world readable" so that every application can read it.
So to summarize and come back to your question: If you can not modify "my_app_1" then it is impossible. Of you can modify both applications choose one of the solutions above.
Two options:
If you are designing both applications and want to share the file, keep it somewhere else (for example - external storage) or make it world readable.
If you are trying to read another app's file - well, you shouldn't, that's a key element in the android security architecture.

Categories

Resources