Is there a way to start the emulator (in order to update the Companion APK) without logging into MIA APP INVENTOR site (i

Hi,
I am a teacher and I need to install this update for the companion on ~70 computers this summer (4 schools, 15-20 computers each).
Is there a way to start the emulator without logging into google, opening APP INVENTOR site etc.? This way I can just start the emulator, drag & drop the latest APK and be done.
Thank you!

Hi @yossi,

Which version of aiStarter are you currently running? The instructions I could provide will depend on that information.

Hi,

Tthe info I get when I open AI Starter is listed in bold below.
Hope this helps.
I checked the details in the aiStarter.exe file, but could not find any information about the version. The file on my computer was lat modified on 16/9/2022.
Yossi

App Inventor version: 30.265.0
Architecture: AMD64
AppInventor tools located here: C:\Program Files\MIT App Inventor

ADB path: C:\Program Files\MIT App Inventor\from-Android-SDK\platform-tools\adb
Bottle v0.12.13 server starting up (using WSGIRefServer())...

That's helpful, thanks.

Starting with the 30.x build series of the emulator, we switched to a model where the aiStarter program installs the companion app on first boot, so at a minimum you will want to replace the MITAI2Companion.apk file in C:\Program Files\MIT App Inventor with the latest one for the emulator: https://ai2-appinventor-mit-edu.ezproxy.canberra.edu.au/companions/Emulator.apk. Note that the filename MUST be MITAI2Companion.apk

If your students have individual accounts, then any new students will get the new version automatically when they start.

If students share an account, or you have returning students, you will need to instruct them to use the Connect > Hard Reset menu item to reset the emulator. The next boot should reinstall the companion app.

If you want to semi-automate the process in a shared account environment and you can log into the student accounts, then you can do something like this in Windows PowerShell:

Invoke-WebRequest https://ai2-appinventor-mit-edu.ezproxy.canberra.edu.au/companions/Emulator.apk -OutFile MITAI2Companion.apk
Invoke-WebRequest http://localhost:8004/start/
sleep 20
C:\Program Files\MIT App Inventor\adb.exe install -r MITAI2Companion.apk
Invoke-WebRequest http://localhost:8004/reset/

I'm not in a position to test this script at the moment so it may need to be tweaked. Effectively, the idea is to download the emulator APK, start the emulator by calling the relevant route in aiStarter, wait 20 seconds for it to boot, then install the new MITAI2Companion.apk. The last line calls the simple reset option which shuts down the emulator (equivalent to Connect > Reset Connection in App Inventor).

Hi,
Thanks for the detailed response.
Actually the part I'm trying to avoid is "logging into the google account".
Is there any way I can just launch the emulator from the command line (without connecting to MIT APP INVENTOR web site) and then I can drag & drop the latest apk into it?
Thank you!

This is not what I am speaking about in my previous post. I am talking about the user accounts on the computers themselves.

When you run the emulator, the contents are copied to a subdirectory of the computer user's home directory that is writeable so that the emulator can make changes (e.g., receive assets). When the emulator starts, it installs the MITAI2Companion.apk file if it can't find an existing installation on the emulated device. Since all of this is tied to the Windows user account, it must happen under that account, but that account has no association with the student's App Inventor account (whether via Google or the anonymous accounts on code.appinventor.mit.edu).

(added to Schools section of FAQ)

To expand a bit on my previous comment, the emulator image files are copied to %APPDATA%\AppInventor, so in the Windows Command Prompt you should be able to get there by running cd %APPDATA%\AppInventor. The %APPDATA% directory itself is derived typically from the user's home directory.