This is about installing Emacs into an Android device. 
See GoogleAndroid for tips about using Emacs to develop Android applications.

=FSF GUI port=

A port of Emacs to Android as a GUI application is available in Emacs 30.1.

This port features extensive support for touch screen input and on-screen keyboards, coupled with accessing storage devices mounted through "content providers" via the Storage Access Framework, and a plenitude of other features.
 
Regularly updated prebuilts of both development snapshots and releases are available at: https://sourceforge.net/projects/android-ports-for-gnu-emacs

F-Droid also provides prebuilts, but they are at times outdated, and do not work on older systems.

Instructions for how to use Doom Emacs on this port: DoomEmacsOnAndroid

Instructions for how to use Spacemacs on this port: SpacemacsOnAndroid

==Download and Android-specific quirks==

Remember to Read https://ftp.gnu.org/gnu/emacs/android/README

It contains download links and answers to many android-specific Emacs quirks, how to inter-operate with termux, and more.

==Wrapping Long Lines==

As typical phone screen is in portrait mode, text with 70-char column width might become unwieldy to read.  You can try using the following packages from Elpa:

 visual-fill
 adaptive-wrap

by Stefan Monnier, et al.

Then, as indicated in the README file, simultaneously enable three minor modes:

* visual-line-mode (emacs built-in)
* visual-fill-mode (from package visual-fill)
* adaptive-wrap-prefix-mode (from package adaptive-wrap)

Scroll to the bottom for a demo.


==Modifier Bar==
If you need the modifiers, (Ctrl, Meta, Super), enable modifier bar.  It is part of the tool bar.  See below for a demo.

You can use (tool-bar-position 'bottom) to adjust its position.
You need to enable tool bar for modifier bar to work.

However, for convenience, you should access frequently used functions in the menu bar, see below.

==Customize Menu Bar==
Most Android systems do not have a physical keyboard.  But this need not be a hindrance.  You can add frequently used functions to your own menu bar.

In my case, I use Org Agenda and Magit frequently on my phone.  On my laptop, (org-agenda) is bounded to "C-c a".  On my phone, I use

  (easy-menu-define my-menu global-map
    "My Customized Menu for using Emacs on Android."
    '("My"
      ("File"
       ["Save buffers" save-some-buffers])
      ("Org"
       ["Agenda List" org-agenda-list]
       ["Global TODO List" org-todo-list]
       ["Search for Keywords" org-search-view])
      ("Magit"
       ["Status" magit-status])))

This code fragment defines the new menu, "My", and adds three submenus, "File", "Org", and "Magit".

For a demo, scroll to the bottom of this page.

==Always show soft keyboard==
In some cases, such as the agenda dispatcher, the buffer is read-only, but the query still depends on a key press.  In this case, the default behavior is to hide the soft keyboard.

You can set (touch-screen-display-keyboard t) to avoid this pitfall.
==Disable text conversion==
In order to support features such as auto-correct, auto-complete, input characters are not directly processed by native android emacs.  Rather, a text conversion is performed.

This is helpful if you rely on Android to input complex text.  However, if you wish to use emacs built-in input methods, you need to disable the conversion by setting (overriding-text-conversion-style nil).

See also the function set-text-conversion-style.
==CJK Font==
See [[CjkFont]].
=Emacs within a GNU/Linux chroot=
Emacs on Android, without requiring root or special setup, can be installed in a chroot environment such as provided by [https://userland.tech/ UserLand] which can even give an optional desktop environment. 

With UserLand, you can install a variety of different distributions. 
Here are some of the commands to install emacs on some of them: 

Another solution is [https://termux.com Termux]. There, just Debian is supported. 

In Alpine (recommended)

[code]apk update && apk add emacs[/code]

In Arch Linux

[code]pacman -Syu && pacman -S emacs[/code]

In Debian/Ubuntu

[code]apt update && apt install emacs[/code]

=Caps Lock as Ctrl and Sticky Keys=
Useful if you are using an external physical keyboard.  See [[StickyModifiersAndroid]]

=Demo=
[[image:EmacsOnAndroidWrapLong]]
[[image:EmacsOnAndroidEasyMenuBar]]
[[image:EmacsOnAndroidModifierBar]]
----
CategoryPorts
