Choose folder on Android device - android

I would like to let user pick directory and save downloaded file (my app downloads file).
I know that some tools (for example, ES File Explorer) provide such intent-filters.
see http://www.estrongs.com/en/support/developers.html. I start activity for result and then get selected folder as a result.
Also, I know that there are no "select folder" intent standards (I can't use the same intent with other tools). Do you know other tools to support such functionality ? I would like to let user use his tool, not ES File Manager.
Also, does Astro provide such intent filters? I can't find this info on their page. (I think astro is the most used file manager for android)

I've recently come across something that might potentially help here:
http://www.openintents.org/en/node/159
It has a demo application showing how it can interact with third party applications as a file/directory picker.
That said, I have not tried it yet. I stumbled across this question as I am still looking for other options.
Edit: actually, it looks very similar to your ES File Manager link. Perhaps it is merely a clone.

Here is complete Android library: https://github.com/lemberg/directory-selector-dialog-preference
It can be used either as DialogFragment or as DialogPreference. I am it's author so don't hesitate to ask any questions.

Related

Associate a directory with my app in internal storage

I do not actually know what this is called. But I have seen app icons beside their directories in internal storage. I assume that it's some kind of association. I would like to know how to achieve this for a directory made by my app.
Here is a screenshot showing Telegram and WhatsApp doing what I want:
I am using the following to create a directory:
File(Environment.getExternalStorageDirectory(), "MyApp").mkdirs()
What else should I add to the above code?
What else should I add to the above code?
Nothing. And note that this code does not work on Android 10 (by default) or Android R+ (for all apps), as external storage has been locked down.
But I have seen app icons beside their directories in internal storage.
Note that from an Android SDK standpoint, you are looking at external storage. More importantly, you are looking at external storage through some app.
I would like to know how to achieve this for a directory made by my app.
There is nothing in Android directly for this. You will need to talk to the developers of the app that you used (where you see this icon) and ask what they are doing. It could be as simple as "see if there is an installed app with the same name as the directory" or "see if there is an installed launcher icon with the same name as the directory".
Because I have seen it all file managers I have used
That means that you have more people that you can contact to see what they are doing. Again, there is nothing in the OS for this. After all, if there were, I could write an app to associate my app icon with every directory, and others could do the same. Whatever these file managers are doing, hopefully it is based on information that apps cannot manipulate to somehow spam the association information.

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

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.

Android : use the explorer?

I want to allow the user to choose a file in the explorer. (Specifically a PDF file only)
I searched a little, but I don't arrive to find something in the developer doc Android.
There is nothing to do it easily ?
For example, I want something like GMAIL uses when the user wants to join a file to a mail.
Thx for help,
Sadfully, you have to write an fileexplorer yourself or us an external fileexplorer (which isn't always present). As I've got the same problem the last days, this might help you: https://stackoverflow.com/a/25724970/3960095. It's a filebrowser in a Fragment. Feel free to use it :)

android - prompt user for path/filename

I want to ask user to select a file to open from external storage and receive it's path. Preferably I'd like to avoid excesive coding and use some standard method (well known, system-provided intent or similar).
Said file is to be SpatiaLite db file (*.sqlite), so it won't show in Gallery.
Unfortunately there is no Android native file picker, but you can get an open-source one to add in your project, then modify it to fit your needs. Check out this SO question for a good start.
I would also suggest that Android file pickers have intents that you can feel free to use. Unfortunately if the user does not have the proper apps on their device, your intent will not succeed. If this happens, you can always direct the user to download the app. Alternatively, you can check if the file picking intent will succeed (see this advice), and use the standard file picker if so (many users have ASTRO, for example, which I think has an intent you can use), and you can fall back on something included in your app, this will make for a perhaps nicer end to end user experience across apps on their device.

Simple editor for Android Permissions File

I am new to Android and Eclipse development, but not new to software development in general.
As my first real project, to get over the learning curve, I am modifying the SDK example soft keyboard.
I would like to add a macro capability. So far so good.
I have created a Permissions file to hold the macro string definitions and store that in the getApplicationInfo().dataDir – which turns out to be something like "/data/data/…". I can write then read back a single key-value pair – so I know the file exists. But, I can't see the file using Astro file manager or an FTP program looking at the Device. I have a feeling I may not have the access permissions to view the directory and I don't have root.
I would have liked to edit the macro definitions in this file on a PC and then save it back to the proper location – that would've been the easy solution. I think my other options are to create a simple key-value parameter by parameter editor or somehow use intents to open the file using some already available text file editor. I am guessing the second option will also encounter the file permissions problem.
A third option would be to store the file in some publicly available directory. I tried using a few "get DIR's", but they required a higher level SDK than I was using – I would like to stay compatible with version 6 and below.
Can somebody offer suggestions on how I can edit the key-value pairs or find a public place to create this file? And, where to look to find an example of how to implement the suggestion?
Thanks much,
Barry.
You can save any data in the SD card. Please read the SDK here, where there is a code snippet which may help you.
Try saving the file on your SD card.
http://androidgps.blogspot.com/2008/09/writing-to-sd-card-in-android.html

Categories

Resources