git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

question about making an App for Android


In comp.lang.python, Dennis Lee Bieber  <wlfraed at ix.netcom.com> wrote:
> pyotr filipivich <phamp at mindspring.com> declaimed the following:
>> "A simple program" to divide the amount of "today's" daylight into 12
>> even '"hours", so that Dawn begins the First hour, the third hour is
>> mid-morning, noon is the middle of the day, the ninth hour mid after
>> noon, and the twelfth hour ends at sunset.  Is simple, no?  {no.}

How antique.

> 	Even ignoring "phone" this is anything but simple. It relies upon
> knowing one's latitude and date to allow computing the angle of the sun.

That sounds like one "hard" input, one easy input, and a bunch of
already solved math.

>> But getting from the development environment (the desktop) to the
>> phone is something I am clueless about.
> 	Getting anything that is not written in Java onto an Android phone is
> likely going to be a pain. You will most likely need an environment that
> runs on ARM architecture. And I have no idea what iOS requires.

Running Python on Android is trivial. Install Termux:

https://f-droid.org/en/packages/com.termux/

(Or via Google's app store.) Run Termux then type: 

      pkg up
      pkg install python

To read GPS directly from Termux, you'll need Termux:Api which has an
app part and a package part:

https://f-droid.org/en/packages/com.termux.api/

      pkg install termux-api

Then use the shell command `termux-location -p gps -f last`  (or `-f
once`) to get location.

To get the python onto the phone you may wish to install curl or wget or
git and use them to fetch over the network.

For output you could show text in termux or compose a PNG and use
`termux-wallpaper -f`.

I, myself, have just gotten "cron" like functionality in Termux with
Tasker and the Termux:Task plugin. Every five minutes Tasker runs a
shell script that collects data (`termux-sensor`), simplifies the JSON
output (`|jq`) and writes it to a file on my phone.

https://f-droid.org/en/packages/com.termux.tasker/
https://tasker.joaoapps.com/

This happens completely in the background. Using a script like that to
change wallpaper to show solar hours would, I think, be pretty cool.

Elijah
------
has also compiled code (clang) on Termux