The place where random ideas get written down and lost in time.
Spent the last week or so “rebuilding” Asqare.
Only needs “one last little change”.
Tradeoffs:
- See plenty of things I could change in the game, but that would delay release.
- Did a few minor things to make the game usable on Android 12.
- Will release a “1.4” which is mostly the same thing.
- Wrote dev notes and maybe will do a “1.5” that has game changes.
One thing that works well: Android 12 + Android Studio chipmunk ⇒ Wireless Debugging. Enable in android settings, customize a quick setting tile to toggle it. Very convenient to push/debug from AS that way.
Question: can command-line adb also use Wireless Debugging?
For release, using the B3 script to create a bundle (aab), without the flavors.
This produces a signed AAB (for Dev Console) + temporary APKS for local deployment.
My script signs the AAB using the old jarsigner. I had to work around it that way because the key format is old and I failed to update into a newer format.
Issue: the local APKS are signed with a debug key. Which means I can’t push and update an app store signed binary.
⇒ According to this SO, I should be able to sign the AAB with release and thus the APK should be signed too?
For the Dev Console, the only choice is to upload an AAB. I’m using the self-signed method where the console does not sign the APK for me (I think?)
When uploading the AAB: “Error: To upload an Android App Bundle you must be enrolled in Play App Signing.”
When uploading the signed APK: “You uploaded an APK with an invalid signature (learn more about signing). Error from apksigner: ERROR: MIN_SIG_SCHEME_FOR_TARGET_SDK_NOT_MET: Target SDK version 32 requires a minimum of signature scheme v2; the APK is not signed with this or a later signature scheme”
The “signature scheme v2” is explained here: https://source.android.com/security/apksigning/v2
The tool to use is “apksigner” available in build-tool 24.0.3 and above.
However I had already tried it years before and my signature uses an older SHA-1 which is now considered obsolete; I had tried to change the keyfile with no success.
Plan B:
“Google isn't protecting the app signing key for your app. Opt in to use Android App Bundles”
I had to do that for Bearing and Seeds: see “\pɔʁt.na.wak\”
Learning for these:
- The Opt In selection in the Dev console is FINAL. The choices are confusing, poorly explained, and there’s no way to change them later on. <grrr>
- Be very careful to select the option to keep using my signing key and not let the store generate a new one. This is NOT the default and it’s a PITA to use.
- Need their PEPK tool to sign the release key to set it up the first time.
- Need the upload key from the store.
Opt In:
- In screen “Let Google Play manage your app signing key”:
- Use option “Use existing app signing key from Java KeyStore”
- Generated a release key based on my key using PEPK ⇒ that’s the same signature arguments as used for Bearing, so maybe keep that file around and write down where it is!
- Upload release key
- Save
IMPORTANT:
- My keystore has 2 aliases. Asqare uses alias 1. Bearing/Seeds used alias 2. Because history.
In the Dev Console:
- Upload an AAB to the Internal Testing track.
- WAIT for an email from Firebase Test to get a health check on many devices.
- Takes at least 5 hours, but less than 24 h.
- Once it’s fine, convert it to a prod push.
- There’s an email when it’s available.
2022-05-11 - Updating Android Apps
Category DEVThe new google play mandate is that apps must somewhat follow the latest API level, or risk getting booted out of the store after a certain delay.
https://developer.android.com/google/play/requirements/target-sdk
“Starting in November 2022, app updates must target API level 31 or above and adjust for behavioral changes in Android 12;”
https://support.google.com/googleplay/android-developer/answer/11926878
- New Apps: API 31 by 2022-08-01.
- App Updates: API 31 by 2022-11-01.
- Existing Apps: API 31 by 2023-11-01 / API 30 by 2022-11-01.
TL;DR: So that means all apps should be API 30 by Nov 2022, but because they would be updates they need to be API 31, so we might as well bring them to API 32 right away.
The plan is to try to update apps on a rotating basis, for example one per month.
For that, I need a list, and I’ll reuse my gradle-version spreadsheet.
List has been updated:
Ralf Flashlight (done) |
Prod v123 |
4 |
3 |
4 |
Nerdkill (done) |
Prod v105 |
4 |
3 |
4 |
Mandelbrot Map 2 |
Prod v13 |
11 |
4 |
11 |
Asqare (done) |
Prod v102 |
1 |
1 |
1 |
Brighteriffic |
Prod v103 |
4 |
3 |
4 |
Cangrejo |
Testing v1 |
29 |
18 |
29 |
Jump! |
Prod v4, Testing v3 |
29 |
27 |
29 |
Project E |
Testing v1 |
29 |
18 |
29 |
Seeds (done) |
Prod v402005 |
28 |
2022-05-11 - Google I/O 2022
Category DEVThings to try:
- Jetpack Compose for Android UI (e.g. Timer app)
- Flutter 3
- Google Cloud Run as an alternative to Amazon w/ React
Nerdkill could be a good subject to try the latest “Flutter 3 Casual Game Kit” thingy.
I’ve been thinking about how Lacan uses his Arduino for his aircraft animation.
What he needs is really a sequence controller to create time-base sequences triggered by input events.
If I had to program this from scratch, what would I do? I’d create a “mini language” using either macro or C++ objects which represents states to change over time:
- LED timings is really just a list of (start timestamp, LED pin, LED state).
- Servos: (start timestamp, servo pin, angle to reach, speed or duration)
- Motors: (start timestamp, motor pin, power level, direction)
- Instructions to end sequence, repeat N times, or chain to another sequence.
Depending on the specific needs:
- Sequence(s) are started by an input (with either forced restart or don’t retrigger).
- Need more than one concurrent sequence? Make each sequence independent. That is each sequence is started and actuates by itself on main clock.
- Need to make sequences run solo? Have an instruction that stop/cancel all other sequences.
- Maybe put sequences in groups (e.g. “servo groups”, “lights groups”) and make the group exclusive as in only 1 sequence runs in the group, or be able to stop any running sequence in the group.
For example for the case of the variable geometry plane:
- IR button 1 ⇒ sequence 1 = stop sequence 2, move servo N up to 60. No retrigger.
- IR button 2 ⇒ sequence 2 = stop sequence 1, move servo N down to 0. No retrigger.
- IR button N ⇒ sequence N for lights.
It seems so obvious that I would be surprised if this had not been done before and be made available as a customizable library for arduino.
For model trains, there are a couple obvious usages:
- Sequencing road traffic lights, e.g. to animate a city.
- With the addition of a “random LED value” instruction, animate anything from a camp fire to a building in fire.
2022-02-20 - Cat Litter Box Timer
Category DEVWhere’s the source for the current “Timer” app used for the litter box?
Device it uses: Tmo (saffire?) 3g something… running Android 2.2 (aka Froyo).
API level ⇒ API 8
As an exercise, it would be nice to rewrite this in Kotlin to see if it can run on Froyo. (FAQ says there’s no min sdk req).
2021-12-25 - Conductor 2
Category DEVIt's time to reflect on Conductor 2 again.
The repo branch has been going nowhere lately. I moved the project to a new repo (in the randall-layout workspace) and only copied the conductor 1 part. That made me realize I'd be throwing away a valuable part with the SVG map.
So first I want to salvage that part. The UI is and should be separated from the engine. This UI was going to drive a simulator, and I can likely make that happen on top of conductor 1.
The next part I want is to formalize the spec for conductor 2. Forget the syntax for now, I need to get the requirements right first: block handling, route management, and fully convert a current script. Also write some examples for eg window block handling.
(Reading between the lines, what I’m saying is that the Conductor-2-with-Groovy-DSL shows me that in fact I want more profound changes than “just a DSL”. I really want to rethink the entire way the automation scripting is done.)
Then once we have that we can figure the implementation. Maybe getting entrenched in groovy is not helpful here. There's clearly some value in not writing my own language, unless it slows me down.
The discussion continues in the Conductor 2 doc.
2021-12-19 - Status of Conductor 2
Category DEVI haven’t written one so it’s worth explaining the status of Conductor 2:
- Entirely rewrote the current v44 script using an “enhanced” version of Conductor 1 syntax to explore a realistic way to describe and use the new routes concept.
- Considered whether it’s worth pursuing the Groovy DSL vs extending the Conductor 1 DSL…
- The decision is that the former Conductor 2 Groovy DSL is obsolete. It was premature. Part of the issue was that it was getting entrenched in bridging the functionality and implementation (at the same time) with the former Conductor 1 engine. That is not the proper way to prototype.
- Instead, modularized the Conductor 1 source code to move the engine/DSL into a sub-project.
- And added a mock Conductor Groovy DSL rewritten from scratch, focusing on how the syntax would work rather than the actual implementation. There are unit tests but they only validate that the DSL can actually encode what it’s supposed to.
- The goal is to later also do a mock Kotlin DSL and compare.
- I still need to create a fat jar where this is invoked as Jython add-on from JMRI, to ensure there’s no library mismatch for example when running Groovy or Kotlin runtime code.
- That led me to explore the fundamental issue with the current route system, namely that we must have “managers”, “active routes”, and the sequence/shuttle manager should deal with a node graph instead of a “block list”. After much back-and-forth debate, I think I finally have a system I can endorse. Now I must encode it using the Groovy DSL.
Right now on the laptop for RPisicine I have:
$ node --version ⇒ v14.11.0
$ npm --version ⇒ 6.14.8
https://github.com/nvm-sh/nvm
⇒ install.sh
$ nvm list # takes a while...
Install steps recommend to remove “-g” (global) modules that will likely break when changing version globally:
$ nvm use system
$ npm uninstall -g nwb
$ npm uninstall -g serve
$ nvm install v14.11.0
In rpiscine:
$ node --version > .nvmrc
$ nvm use # in that directory, to switch to that version
How does changing the Node version with nvm affect the NPM version?
⇒ The NPM version depends (and varies with) the Node version being used. E.g.:
$ nvm use node
Now using node v14.11.0 (npm v6.14.8)
$ nvm install node
Now using node v17.1.0 (npm v8.1.2)
For Windows, there’s https://github.com/coreybutler/nvm-windows
To fix the NVM PATH in CMD.exe: Not really an option when installed using nvm-sh since the latter does not create an “nvm.exe” or “nvm.sh” -- instead all the nvm commands are bash functions loaded in the interpreter (meh). But we can work around it:
- cygwin: $ cygpath -w $(dirname $(nvm which --silent))
- ⇒ C:\Ralf\.nvm\versions\node\v18.8.0\bin
- Copy path to a CMD.exe.
- cmd: $ refreshenv ← optional, because I have chocolatey installed.
- $ set PATH=C:\Ralf\.nvm\versions\node\v18.8.0\bin;%PATH%
- $ echo %PATH%
2021-10-11 - RPiscine project
Category DEVAn update on Projet RPiscine aka Piscine 2:
- Python service: access RPi PiFace, store data, expose data via REST JSON.
- React JS served via nginx to connect to the Python service + visualize the data.
This worked very well. The “backend vs frontend” split was good.
The setup allows for a local react dev on laptop, build on laptop, then push the build site to the RPi.
This runs on an RPi 1 B (the older kind), with Debian buster, and using systemctl services for the python wrapper. Also a reverse-ssh service wrapper is created, which works very nicely. Using the new systemctl service is a nice improvement over the old initd scripts.
What would it take to do an Android app that is modular and where each feature is controlled by a remote server feature flag?
Would I choose something like Firebase, AWS, or a custom server like Alfray or RDRR?
The data itself would likely be json or proto. We would want to have version capabilities.
Notions that become relevant are cold vs hot config, refresh times, networks caching. Also an ETag / checksum system could be used to only send diff/update and minimize network traffic.