I've been tasked with getting App Inventor 2 working in one of our schools.
Installed the emulator tools
Logged onto the site
Emulator runs
Updates
I then can't update the Companion.
If I take the laptop home with me (device is still connected to our network via DirectAccess), then Companion updates.
I can then browse the WWW on the emulator using the browser app.
However, if I try it again back inside the school then I can no longer browse the WWW in the app.
My theory is that I need to configure the emulator to use our proxy.
Otherwise, it's just trying to go direct out to the WWW - which is why it works at home (where I have direct line of sight to the WWW), but not in the school (where firewalls prevent direct traffic to the WWW).
Everything else seems to run fine. It's only if I try to hit the WWW inside the emulator.
Is there an option somewhere which says to use the proxy?
If by "whitelist", you mean add a list of sites which can get out to the WWW, then users can access all of those URLs fine in Chrome.
If you mean that emulator attempts to hit them DIRECTLY - that's not going to fly... Everything which connects using standard http/https needs to go via the authenticated proxy.
The documentation says "emulator.exe program be able to make outgoing requests to ai2.appinventor.mit.edu and code.appinventor.mit.edu."
Users can authenticate with that no problem at all. My assumption is that something is telling the emulator to NOT use the authenticated proxy, but to go out direct.
I had found someone who created a customised emulator launcher which includes a section on configuring the proxy settings. I didn't want to use their launcher, but assume that all their launcher does is change a config file somewhere.
You mention a specific port being required to be open. Is that specifically for the browser/companion to download? (I don't know what CloudDB is - I'm just the poor soul saddled with "make this emulator thing work" type requests heh).
We're on Chrome 93. The FAQ you linked to mentions Chrome 89 breaking companion connections, and Chrome 94 breaking emulator connections. I'm assuming Chrome 93 is OK?
once upon a time, if you used the emulator package provided by MIT, your firewall needed to be configured to allow the aiStarter program to listen to incoming connections on port 8001 and 8004. Starter provides access to the emulator. The former is used to send the code from the browser to the companion and the latter is used to manage the emulator state. This discussion might make sense to you Emulator issues - #16 by SteveJG
try using Firefox instead of Chrome
try a different emulator (GennyMotion )
re: Chrome, I don't know assume Chrome might be ok but try Firefox.
understand; If this stuff doesn't work I will see if a MIT expert can provide some more suggestions after you tell us what your tried.
Hi. Thanks for the reply, and the link to the post.
We don't have the local firewall enabled at all.
My symptoms match the last part of that post you linked to - everything works, except WWW access inside the emulator.
Unlike the other post, linking the PCs to a hotspot isn't an option.
If this emulator doesn't have an option to honour proxy, I'll take a look at the other emulator suggested.
Which is really annoying - I had everything else working sweet as a nut. D'oh!
D'OH! Genymotion free is for personal use only . You must not share your account with other students, or use Genymotion on a public device such as a school computer.
If you are a teacher or a school, you must not use Genymotion Desktop free edition for tuition. However, we have a special license for education purposes.
@jis , do you have any advice for this school IT person to help with his emulator issue?
@gerardsweeney , so you cannot use Genyotion. There are other Android emulators. Bluestacks is one I know. I don't know whether it will ameliorate your school emulator issue or not.
MIT only offers the basic emulator to work seamlessly with App Inventor. To use an alternative emulator one will enter it using Companion instead of the 'Emulator' option .
There is a way to tell the emulator to use an http proxy. You want to find the run-emulator (or run-emulator.bat) command. I'm not sure which directory it is stored in (I don't have a Windows machine or Mac handy). You will see that that script (batch file) invokes the "emulator" command with a bunch of options. Add the "-http-proxy <your proxy>" to the line where the emulator is invoked. You will have to do this on each machine.
It may be easier to white list ai2.appinventor.mit.edu (which is where the emulator will download an update from).
We're deploying this via SCCM, so I should be able to just copy over a modified .bat file - we're already doing that to set the application to save to %LOCALAPPDATA%.
Can I ask - are these command line switches documented anywhere?
I was unable to find any help on command line switches, but my Google-Fu might have let me down.
Just in case I need to tweak something else (fnar! Ed)
The emulator itself comes from Google, and the version we are using is very old. A trick that works though is to invoke the emulator binary with an argument of -help. It then lists all of its (at least documented) control arguments.
Excellent - why didn't I think of that?! Oh, yes - my brain is fried
Thanks lots for this tip (and for adding to the FAQ).
By way of return, I don't know if this will be of use to anyone?
In our environment, we have pupils using a different proxy from staff (set by GPO).
So I prefer to keep applications running with the same proxy as they're meant to.
Here's a bit of pockling I did to the run-emulator.bat file. I adapted/nicked the code from another site, so I've included a note of the source site - credit where it's due!
rem get the current proxy
rem based on script from Read Registry value into a batch variable – Domain Web Center
set regkey=HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings
FOR /F "skip=2 tokens=2,*" %%A IN ('reg.exe query "%regkey%" /v "ProxyServer"') DO set "userproxy=%%B"
And then change the lines which run the emulator so that
-no-boot-anim
now reads
-no-boot-anim ^
-http-proxy %userproxy%
Using this means that it'll always read the user's proxy settings from the registry.
Handy if your Infrastructure team migrate users to a differently named proxy.
Caveats - I haven't tested this code extensively. And I don't know what'll happen if the user doesn't have a proxy set