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
Data repo for one-among.us

Our Data Data repo for one-among.us File Structure Directory /people/userid/: Data for a specific person info.json5: Profile information page.md: Pr

Hykilpikonna 55 Dec 30, 2022
Python library for the analysis of dynamic measurements

Python library for the analysis of dynamic measurements The goal of this library is to provide a starting point for users in metrology and related are

Physikalisch-Technische Bundesanstalt - Department 9.4 'Metrology for the digital Transformation' 18 Dec 21, 2022
A basic python project which replicates the functionalities on an 8 Ball.

Magic-8-Ball To the people who wish to make decisions using a Magic 8 Ball but can't get one? I gotchu. This is a basic python project which replicate

3 Jun 24, 2021
Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat

Video Stream is an Advanced Telegram Bot that's allow you to play Video & Music on Telegram Group Video Chat 📊 Stats 🧪 Get SESSION_NAME from below:

dark phoenix 12 May 08, 2022
Supply Chain will be a SAAS platfom to provide e-logistic facilites with most optimal

Shipp It Welcome To Supply Chain App [ Shipp It ] In "Shipp It" we are creating a full solution[web+app] for a entire supply chain from receiving orde

SAIKAT_CLAW 25 Dec 26, 2022
Pykeeb - A small Python script that prints out currently connected keyboards

pykeeb 🐍 ⌨️ A small Python script that detects and prints out currently connect

Jordan Duabe 1 May 08, 2022
Pequenos programas variados que estou praticando e implementando, leia o Read.me!

my-small-programs Pequenos programas variados que estou praticando e implementando! Arquivo: automacao Automacao de processos de rotina com código Pyt

Léia Rafaela 43 Nov 22, 2022
Synchrosqueezing, wavelet transforms, and time-frequency analysis in Python

Synchrosqueezing is a powerful reassignment method that focuses time-frequency representations, and allows extraction of instantaneous amplitudes and frequencies

John Muradeli 382 Jan 06, 2023
Cobalt Strike Sleep Python Bridge

This project is 'bridge' between the sleep and python language. It allows the control of a Cobalt Strike teamserver through python without the need for for the standard GUI client. NOTE: This project

Cobalt Strike 140 Jan 04, 2023
A simple website-based resource monitor for slurm system.

Slurm Web A simple website-based resource monitor for slurm system. Screenshot Required python packages flask, colored, humanize, humanfriendly, beart

Tengda Han 17 Nov 29, 2022
PDX Code Guild Full Stack Python Bootcamp starting 2022/02/28

Class Liger Rough Timeline Weeks 1, 2, 3, 4: Python Weeks 5, 6, 7, 8: HTML/CSS/Flask Weeks 9, 10, 11: Javascript Weeks 12, 13, 14, 15: Django Weeks 16

PDX Code Guild 5 Jul 05, 2022
A web-based chat application that enables multiple users to interact with one another

A web-based chat application that enables multiple users to interact with one another, in the same chat room or different ones according to their choosing.

3 Apr 22, 2022
Send notifications created in Frappe or ERPNext as push notication via Firebase Cloud Message(FCM)

FCM Notification for ERPNext Send notifications created in Frappe or ERPNext as push notication via Firebase Cloud Message(FCM) Steps to use the app:

Tridz 9 Nov 14, 2022
Inacap - Programa para pasar las notas de inacap a una hoja de cálculo rápidamente.

Inacap Programa en python para obtener varios datos académicos desde inacap y subirlos directamente a una hoja de cálculo. Cómo funciona Primero que n

Gabriel Barrientos 0 Jul 28, 2022
Comprehensive OpenAPI schema generator for Django based on pydantic

🗡️ Djagger Automated OpenAPI documentation generator for Django. Djagger helps you generate a complete and comprehensive API documentation of your Dj

13 Nov 26, 2022
Drop-down terminal for GNOME

Guake 3 README Introduction Guake is a python based dropdown terminal made for the GNOME desktop environment. Guake's style of window is based on an F

Guake 4.1k Dec 25, 2022
Pacman - A suite of tools for manipulating debian packages

Overview Repository is a suite of tools for manipulating debian packages. At a h

Pardis Pashakhanloo 1 Feb 24, 2022
A streamlit app for exploring image search results from HuggingPics

title emoji colorFrom colorTo sdk app_file pinned huggingpics-explorer 🤗 blue red streamlit app.py false huggingpics-explorer A streamlit app for exp

Nathan Raw 4 Sep 10, 2022
An assistant to guess your pip dependencies from your code, without using a requirements file.

Pip Sala Bim is an assistant to guess your pip dependencies from your code, without using a requirements file. Pip Sala Bim will tell you which packag

Collage Labs 15 Nov 19, 2022
Fly DCS without a joystick

Intro Usage Delete all mouse view axis Install DCSEasyControlExports to your "Saved Games/DCS/" Path python DCSEasyControl/main.py Set DCS to F12 view

XuHao 36 Dec 27, 2022