Proxy support? Emulator works fine - except browser app

Hi, there.

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?

Cheers,
Gerard

Here's a link to the Companion FAQ:

Unfortunately, I don't see the word 'schools' in it.
When some one chimes in with that link, I will add it.

It would be best to ask your IT department whitelist app inventor. Please see

and

School IT/Network Admins: Information specific to school networks

1 Like

(added to FAQ)

Hi.

Thanks for the reply

I am (one of) the IT Department :slight_smile:

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?

Thanks,
Gerard

Try

  • 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.

:cry: 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.

So - not Genymotion, then.

Any other alternatives?

@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.

There is a list of alternative emulators at

@SteveJG - Thanks for the reply.

The alternative emulator would need to support the MIT Edu system - as the Teacher wants to use that.

Is such a thing possible?

I imagine most Android emulators do that Gerard. You can try Abraham's advice w.r.t. MemuPlay https://community.appinventor.mit.edu/t/mit-app-inventor-setup-is-not-responding/19139/10 or these possibilities https://community.appinventor.mit.edu/t/unable-to-download-emulator-for-windows/26564/2 . Will any solve your issue? I have no idea.

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 .

Here is a link to an MIT experimental replacement emulator Windows: http://ai2-buildserver-nightly-ewp.csail.mit.edu/setuptools-beta/MIT_App_Inventor_Tools_26.251.0_win_setup.exe .

It was posted in 2019 and my experience is it has lots of bugs. You could try that.

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).

-Jeff

1 Like

Excellent - thank you!

I'll take a look at this ASAP.

Oh my giddy aunt - it's actually working!

Thank you - that's fantastic.

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.

-Jeff

1 Like

(added to FAQ, Schools section)

Excellent - why didn't I think of that?! Oh, yes - my brain is fried :slight_smile:
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 :slight_smile:

Thanks!

-Jeff

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.