-
Notifications
You must be signed in to change notification settings - Fork 501
Opening files in the default application #601
Comments
I'm not sure exactly what you mean by this. We have Could you describe a bit more which API's you are suggesting this would use natively on iOS/Android? |
@Redth sir, suppose i wanted to open PDF file in my app. but I and android have no default component to handle PDF, so when user open any file, it should be open in default application(or suggestion of apps, if multiple.) like as below extensions |
@Redth as written by @gsmental when we need to open some files (for example, pdf, docx ...) we would like to give the user a choice of which program he can open the file with. Something like in this link: https://forums.xamarin.com/discussion/103042/how-to-open-pdf-or-txt-file-in-default-app-on-xamarin-forms |
I would like to add some precision to this request. Is there a way to do that : open a local file with the appropriate application ? Before that, I managed this situation with platforme specific code, like for Android : |
I think this is more about the file provider work we are doing. My understanding of the use case is that you really just want to show the platform's native 'share' dialog to let the user pick how to handle a given file. On android that exception is likely due to the fact you are giving a private file path. This is the work we are doing around using a file provider on android (See #130). The idea would be you give the API any file path that you want to share, it will run it through the file provider on android to generate a shareable uri, and then we'd use the native share dialog (so on Android it would pretty much be launching an intent - we might need to discuss how things like content type are inferred or set for this). I'm thinking this issue is really a duplicate of #425 Anybody see a reason this should be kept separate and open? If no objections I'm going to close this one as a duplicate... |
it should be separate reason being, we are not sharing any content with any other app like whatsapp. but we are sending url into another app to handle the activity. if android api version is <=23 then there is no issue. but in upper version of >=24, android has changed some security policies for opening file https://proandroiddev.com/sharing-files-though-intents-are-you-ready-for-nougat-70f7e9294a0b issue is that when we try to access private path with (other app), other app has no permission. |
I don't think it is a duplicate of #425 I don't need to share data with other application. I just want to see the file content with the right default application. |
Perhaps the nomenclature is the problem here. I think this is still technically 'sharing' data with another application, it's just 'sharing' a file that you want another application to open. So take the case I have a PDF file that I want to let the user display. On android I basically create an intent with an I'm still not convinced this is a separate issue from #425 As for @gsmental yes, > API 23 requires a different way of sharing a file due to security, and this is the work we are doing in #130 which will be used by the sharing API. |
We are closing this issue since no response was received. Please open a new issue referring to this one if you have more information. |
Hi everyone! In my case (Android experience) when an application have the ability to work with files (for example Slack, Whatsapp, etc), if I want to open a file for some reason, the app shows me one of the two following options: A few images explains the required feature very well (I have PDF viewer but not DOCX viewer) |
I agree with those that see this is a separate issue from what the Share functionality gives you currently. It is sharing in a sense as @Redth points out, but when you Share.RequestAsync the file gets looked at as a file and you get certain options for a file generically speaking. If you instead were to tap on that file in the built-in file browser for your system you would get a different set of options or it would automatically open (because you've previously associated that file type with an app). In that case it looks more at the file extension, e.g. PDF or DOCX or whatever, to determine what to let the user choose from or to launch. |
Basically: #425 |
…arin#773) * Implement Open File in Launcher. Fixed xamarin#601 & xamarin#425 * Add title to open file request for android launcher * Clean FileBase and AttachmentName. Added documentation. * Fix encoding * Remove namesapces that aren' t needed
The idea is to provide a method for opening files in the application by default.
For example, in my application I need to download files of different types, for example pdf, docx, pictures, and I’ll like to be able to open them with applications already installed, for example Acrobat for pdf, but for the system to choose.
The text was updated successfully, but these errors were encountered: