An Android app that runs Elm in a webview. And a Python script to build the app or install it on the device.

Overview

Requirements

You need to have installed:
  • the Android SDK
  • Elm
  • Python
  • git

Starting a project

Clone this repo and cd into it:

$ git clone https://github.com/leforestier/elm-android-app
$ cd elm-android-app

Then run:

$ elm init

That will create an elm.json file in the current directory.

The entry point of your Elm application is src/Main.elm. This file contains a basic counter app that you can try to build to test that everything is working on your system.

To create a great app, modify src/Main.elm and add other Elm source files to the src/ directory .

To install additional elm packages, you can use elm install just like with any normal Elm project.

Build script

The script that enables you to build and/or install the app onto the device is manage.py. It's a single Python script without any dependencies. You can call it like this on the command line:

$ python manage.py (see next section for available commands)

On Linux you should be able to do simply:

$ ./manage.py (see next section for available commands)

To build an Elm application (running in a webview)

Keystore

First, and this is something you only have to do once per project, create a debug Android keystore using the command:

$ ./manage.py create-debug-key

This creates a keystore in the current directory under the file name debug.keystore.

Environment variables

You need to supply three environment variables to the script:

- BUILD_TOOLS_DIR: the directory of the Android SDK where reside tools such as `aapt` and `dx`.
  For example, I use `BUILD_TOOLS_DIR=/home/myusername/Android/build-tools/30.0.3/`

- PLATFORM_DIR: the directory of the Android SDK where reside `android.jar`.
  For example I use `PLATFORM_DIR=/home/myusername/Android/platforms/android-30/`

- KEYSTORE_FILE: the keystore file. If you created it by `manage.py create-debug-keystore`,
  then the file is `debug.keystore` and you should use `KEYSTORE_FILE=debug.keystore`

The rest of this tutorial assume you have exported these 3 environment variables using:

$ export BUILD_TOOLS_DIR=... PLATFORM_DIR=... KEYSTORE_FILE=...

Build the apk

Build an apk with the command:

$ ./manage.py build

The apk is created inside the build directory.

Install the app on an Android device

Make sure your device is connected to your computer in debug mode (you can use the command adb devices to check if your device appear in the list). Then:

$ ./manage.py install

You can also install the app and start it automatically using:

$ ./manage.py install+run

Changing the name of the application

You change the name of the application exactly like you would in a normal Java only android application.

The name of our example application is "Elm App" and our package name is com.example.elmwebviewapp. Here's how to change it, for, say, a bird watching application called "Bird Watch" with package name net.birdwatchers.birdspot.

To change the application name to "Bird Watch":

  • in AndroidManifest.xml replace android:label="Elm App" with android:label="Bird Watch"

To change the package name to net.birdwatchers.birdspot:

  • rename the directory java/com/example/elmwebviewapp to java/net/birdwatchers/birdspot
  • in MainActivity.java, replace the first line package com.example.elmwebviewapp; with package net.birdwatchers.birdspot;
  • in AndroidManifest.xml, replace the package="com.example.elmwebviewapp" manifest attribute with package="net.birdwatchers.birdspot"

Changing the icon of the application

Same as with a normal Java only android application. Refer to Android development documentation.

Viewing the app in the browser using elm-live

Before loading the app on the device, you can develop using elm-live and see your changes in the browser of your laptop/desktop. This requires to have installed elm-live.

Then:

$ ./manage.py elm-live

This is just a shortcut for:

$ elm-live src/Main.elm -d assets -- --output=assets/main.js
Owner
Benjamin Le Forestier
Benjamin Le Forestier
Python scripts to interact with Upper Deck ePack online trading card platform

This script should connect to the Upper Deck ePack API using your browser cookies and download a list of your current collection and save it as a CSV.

Adrian Kent 1 Nov 22, 2021
A simple, light-weight and highly maintainable online judge system for secondary education

y³OJ a simple, light-weight and highly maintainable online judge system for secondary education 一个简单、轻量化、易于维护的、为中学信息技术学科课业教学设计的 Online Judge 系统。 Onlin

20 Oct 04, 2022
MODeflattener deobfuscates control flow flattened functions obfuscated by OLLVM using Miasm.

MODeflattener deobfuscates control flow flattened functions obfuscated by OLLVM using Miasm.

Suraj Malhotra 138 Jan 07, 2023
A basic DIY-project made using Python and MySQL

Banking-Using-Python-MySQL This is a basic DIY-project made using Python and MySQL. Pre-Requisite needed:-- MySQL command Line:- creating a database

ABHISHEK 0 Jul 03, 2022
A simple API to upload notes or files to KBFS

This API can be used to upload either secure notes or files to a secure KeybaseFS folder.

Dakota Brown 1 Oct 08, 2021
Programmatic interface to Synapse services for Python

A Python client for Sage Bionetworks' Synapse, a collaborative, open-source research platform that allows teams to share data, track analyses, and collaborate

Sage Bionetworks 54 Dec 23, 2022
Mini-calculadora escrita como exemplo para uma palestra relâmpago sobre `git bisect`

Calculadora Mini-calculadora criada para uma palestra relâmpado sobre git bisect. Tem até uma colinha! Exemplo de uso Modo interativo $ python -m calc

Eduardo Cuducos 3 Dec 14, 2021
Criando um jogo de naves espaciais com Pygame. Para iniciantes em Python

Curso de Programação de Jogos com Pygame Criando um jogo de naves espaciais com Pygame. Para iniciantes em Python Pré-requisitos Antes de começar este

Flávio Codeço Coelho 33 Dec 02, 2022
【幼盾】个性化图片徽章服务!

【幼盾】个性化图片徽章服务! 你对方形的徽章感到无聊了吗?想要定制属于自己的开源项目徽章了吗? 快来使用unv-shield吧! unv-shield提供包含自定义图片的徽章服务,可以让你的项目主页更加个性化!

黄巍 130 Dec 23, 2022
Petuhlang is a joke-like language, based on Python.

Petuhlang is a joke-like language, based on Python. It updates builtins to make a new syntax based on operators rewrite.

DenyS 9 Jun 19, 2022
🥦 Send and receive nano with 2 simple functions

easy_nano Send and receive nano (without having to understand the nano protocol).

1 Feb 14, 2022
This is a python package to get wards, districts,cities and provinces in Zimbabwe

Zim-Places Features This is a python package that allows you to search for cities, provinces, and districts in Zimbabwe.Zimbabwe is split into eight p

RONALD KANYEPI 2 Mar 01, 2022
An optional component handler for hikari, inspired by discord.py's views.

hikari-miru An optional component handler for hikari, inspired by discord.py's views.

43 Dec 26, 2022
A project to find out all the words in a crossword.

A project to find out all the words in a crossword.

Kalpesh Dhoundiyal 1 Feb 06, 2022
This is an online course where you can learn and master the skill of low-level performance analysis and tuning.

Performance Ninja Class This is an online course where you can learn to find and fix low-level performance issues, for example CPU cache misses and br

Denis Bakhvalov 1.2k Dec 30, 2022
Rick Astley Language is a rick roll oriented, dynamic, strong, esoteric programming language.

Rick Roll Language / Rick Astley Language A rick roll oriented, dynamic, strong, esoteric programming language. Prolegomenon The reasons that I made t

Rick Roll Programming Language 658 Jan 09, 2023
This is an implementation of PEP 557, Data Classes.

This is an implementation of PEP 557, Data Classes. It is a backport for Python 3.6. Because dataclasses will be included in Python 3.7, any discussio

Eric V. Smith 561 Dec 06, 2022
Height 2 LDraw With python

Height2Ldraw About This project aims to be able to make a full lego 3D model using the ldraw file format (.ldr) from a height and color map, currently

1 Dec 22, 2021
Telegram bot to search quotes from brainyquote.com

Brainy Quote Bot @BrainQuoteBot A star ⭐ from you means a lot to us! Telegram bot to search quotes from brainyquote.com Usage Deploy to Heroku Tap on

21 Nov 24, 2022
MobaXterm-GenKey

MobaXterm-GenKey 你懂的!! 本地启动 需要安装Python3!!!

malaohu 328 Dec 29, 2022