help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Emacs for Android] How to open file with an external app?


From: Antonio Romano
Subject: Re: [Emacs for Android] How to open file with an external app?
Date: Tue, 22 Aug 2023 14:49:07 +0000

Thank your for your help

> By providing a file:// URI to android-browse-url (should the file be
> accessible to all programs)

This works. I opened a buffer for "~/test.epub" and then eval'd the
following
(android-browse-url (concat ["file://"](file://) buffer-file-name))

And it indeed tries to open content://org.gnu.emacs/document/ciao.epub
(as stated in your second email)

However, articulating the question further, if I try to navigate into
"/content/storage/org.nextcloud.documents/2a3683ac919807f000715758ea81ef61%2F665/Ebooks/effectiveawk.epub"
and eval the expression above, it would simply prepend
"content://org.gnu.emacs/document" to the path.

> or a content URI of the following form:
> content://org.gnu.emacs/PATH

I tried the following
(android-browse-url
"content://org.nextcloud.documents/2a368.../Ebooks/effectiveawk.epub")
and got the following error:

java.lang.SecurityException: UID 10713 does not have permission to
"/content/storage/org.nextcloud.documents/2a3683ac919807f000715758ea81ef61%2F665/Ebooks/effectiveawk.epub"
[user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related
apis

But I'm pretty sure Emacs has the permission to access the Nextcloud
document provider, since i can open buffers in it without any
trouble. Maybe i got the URI wrong?

I can also open document provider in a file manager called MiXplorer: i
navigated Nextcloud through it and, strangely enough, it seems that
MiXplorer gives its own content URIs to files:

"content://com.mixplorer.file/1409260714!/Ebooks/effectiveawk.epub"

which, if gives as argument to (android-browse-url), makes the "Open
with..." menu appear.

Document providers look like a mess to me. What's the easiest way to
externally open files in "/content/storage/org.nextcloud/documents/"?

> `android-browse-url' rewrites file URIs into their content://
> counterparts without user intervention. It is not necessary to
> provide a content URI yourself.

>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]