You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
- On Android, I keep getting exceptions that the file is not found, when checking if it exists or trying to copy. Currently, the filepath i'm passing is something like "file:///android_asset/name.pdf".mo alaz– mo alaz2018-10-16 11:10:03 +00:00Commented Oct 16, 2018 at 11:10
- That won't work, since your file isn't lying on a proper file path but is being compiled into your application's assets. Even worse, another app won't be able to access it, since other apps are not allowed to access your app's (internal) assets. So basically you need to get the file content by using Assets.Open("name.pdf"); and write that to a public file location so that the file can be accessed by other apps.Markus Michel– Markus Michel2018-10-16 11:53:04 +00:00Commented Oct 16, 2018 at 11:53
- Ah, ok. Isn't that the reason we are copying the file in the first place? So if the file is in my assets, i would have to use Assets.Open("name.pdf"), write it that to a public file location and i wouldn't need to copy it? What's a public location that all android phones have?mo alaz– mo alaz2018-10-16 13:29:27 +00:00Commented Oct 16, 2018 at 13:29
- Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryDocuments) should return a public directory to use. By default your app, it's assets and even all files it downloads or generates by itself are put inside their own sandbox, which is closed to the outside world (meaning other apps on the same device). The android solution basically asks the other apps, if they can handle the file and then shows the user which apps can use that file. So the file has to made accessible to them by either copying or writing them to a place they are "allowed" to access.Markus Michel– Markus Michel2018-10-16 13:35:30 +00:00Commented Oct 16, 2018 at 13:35
- I just saw that my answer was lacking setting up the fileprovider information in the manifest. I updated that in my answer in the android section.Markus Michel– Markus Michel2018-10-16 13:44:01 +00:00Commented Oct 16, 2018 at 13:44
| Show 1 more comment
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
- create code fences with backticks ` or tildes ~ ```
like so
``` - add language identifier to highlight code ```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- indent code by 4 spaces
- backtick escapes
`like _so_` - quote by placing > at start of line
- to make links (use https whenever possible) <https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. python-3.x), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you
lang-cs