all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Antonio Romano via Users list for the GNU Emacs text editor <help-gnu-emacs@gnu.org>
To: Po Lu <luangruo@yahoo.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: [Emacs for Android] How to open file with an external app?
Date: Tue, 22 Aug 2023 14:49:07 +0000	[thread overview]
Message-ID: <0d6e01a7-7591-4187-8a3d-b3be6cae78fc@pm.me> (raw)
In-Reply-To: <87a5uj8dw2.fsf@yahoo.com>

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	other threads:[~2023-08-22 14:49 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-08-19 14:57 [Emacs for Android] How to open file with an external app? Antonio Romano via Users list for the GNU Emacs text editor
2023-08-22 12:15 ` Po Lu
2023-08-22 12:23   ` Po Lu
2023-08-22 14:49     ` Antonio Romano via Users list for the GNU Emacs text editor [this message]
2023-08-22 23:45       ` Po Lu
2023-08-23 10:05         ` Antonio Romano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0d6e01a7-7591-4187-8a3d-b3be6cae78fc@pm.me \
    --to=help-gnu-emacs@gnu.org \
    --cc=luangruo@yahoo.com \
    --cc=n58r@pm.me \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.