To turn an ebook or documentation into an Android app, write or convert each chapter to HTML (from Markdown, Word or Google Docs), add a table of contents, client-side search and saved reading position in localStorage, bundle the fonts and images, then package the folder as an APK. The result opens instantly and reads fully offline.
Key takeaways
- Markdown is the cleanest source; convert it with the Markdown to HTML book tool.
- Save the last chapter and scroll position so the app resumes where the reader stopped.
- A JSON search index of headings and paragraphs gives instant offline search.
- Respect copyright: only publish books you wrote or have rights to.
1. Get the text into clean HTML
| Source | Best route to HTML |
|---|---|
| Markdown files | The Markdown to HTML book tool, or Pandoc |
| Word (.docx) | Pandoc (pandoc book.docx -o book.html) — far cleaner than Word's own HTML export |
| Google Docs | File → Download → Web page (.html, zipped) — then strip inline styles |
| EPUB | An EPUB is a ZIP of XHTML chapters; unzip it and reuse them |
2. One file or one per chapter?
Under about 50,000 words, a single index.html with each chapter in a <section id="ch-3"> is simplest: navigation is a hash link, search sees everything, and the back button follows the hash history. Larger books load faster as one HTML file per chapter with a shared stylesheet.
3. Reading typography
body { font: 18px/1.7 Georgia, 'Noto Serif', serif; margin: 0 auto; max-width: 38em;
padding: 16px 20px env(safe-area-inset-bottom); }
h1, h2 { font-family: system-ui, sans-serif; line-height: 1.25; }
img { max-width: 100%; height: auto; }
@media (prefers-color-scheme: dark) { body { background: #121212; color: #e6e1d8; } }Let readers change size: store a font-size value in localStorage and apply it to document.documentElement.style.fontSize.
4. Resume where the reader left off
// save position (throttled)
let t;
addEventListener('scroll', () => {
clearTimeout(t);
t = setTimeout(() => localStorage.setItem('pos', JSON.stringify({ hash: location.hash, y: scrollY })), 300);
}, { passive: true });
// restore on launch
const pos = JSON.parse(localStorage.getItem('pos') || 'null');
if (pos) { if (pos.hash) location.hash = pos.hash; requestAnimationFrame(() => scrollTo(0, pos.y)); }5. Offline search
Build an index once at start-up from the headings and paragraphs, then filter as the reader types. For a few hundred pages, a plain loop is fast enough; libraries such as MiniSearch or Lunr help beyond that (bundle them locally).
const index = [...document.querySelectorAll('section h2, section p')].map(el => ({
id: el.closest('section').id, text: el.textContent.toLowerCase(), el }));
function search(q) {
q = q.trim().toLowerCase();
return q.length < 2 ? [] : index.filter(e => e.text.includes(q)).slice(0, 30);
}6. Package and ship
ZIP the folder and build it in HTML & ZIP to APK Builder. For a manual or handbook you update often, keep the same package name and raise the version for each edition. If the content is sensitive (an internal handbook), remember an APK can be unzipped — anyone with the file can read the HTML.
Frequently asked questions
Can I sell my ebook as an Android app?
Yes, if you own the rights. Google Play allows paid apps; Play's policies on book content and copyright apply as they would to any app.
Is an app better than an EPUB?
An app gives you your own icon, custom design, interactive elements and search. An EPUB works in every reading app and is easier to sell through bookstores. Many authors offer both.