We can manage a Firestick 4K (and other android devices) using ADB. This is an app/service that is run from the command prompt, by manually typing in the ADB commands.
This can be done on the local network (LAN) or on a remote network (WAN) via the Internet.
I am going to show two methods to access the Firestick 4K remotely via the Internet.
I discuss both methods here.
This page covers method 2 (using ngrok).
Update (September 2021): Instructions and scripts slighly amended as scrcpy now puts transferred files in sdcard/download folder by default (instead of just root of sdcard).
Method 2 is using an ngrok tunnel, which is an Internet relay service. From the ngrok site: “Ngrok exposes local servers behind NATs and firewalls to the public internet over secure tunnels. Connect to the ngrok cloud service which accepts traffic on a public address. Traffic is relayed through to the ngrok process running on your machine and then on to the local address you specified”.
Simply put, for a Firestick 4K: The ngrok app is run on the Firestick 4K. This exposes the Firestick 4K ADB service to the ngrok cloud service and generates a URL that can be used to access the ADB service from a remote computer. On the computer you make an ADB connection using the generated URL. ADB commands are relayed from the computer, through the ngrok cloud, to the Firestick 4K. As the Firestick 4K initiated the connection (to the ngrok cloud), no port forwarding is required on the router.
This page is for using the free ngrok service and does not use any custom domains. It is the simplest to setup. I recommend you use this method initially and then move to the paid service, if this is something you would prefer. I will write a page soon for configuration of the paid service and for using custom domains.
I have also created a video that covers this setup in detail. The video is at the bottom of this page.
There are a few methods you can use to setup ngrok on the Firestick 4K. The easiest and fastest is to visit the remote site and use Flakie ADB GUI and scrcpy. This is the method I am using in these instructions. If you have another method of connecting to the remote Firestick 4K (with router port forwarding for example) you can use this (and remove the port forwarding afterwards if you like, for more security). Or you can use a physical keyboard at the remote site. You can also just use the Firestick 4K remote control to do this at the remote site. This is by far the slowest and hardest method.
There is a simplified text version of these instructions, you can use to copy and paste the necessary commands.
This is also included in the setup-ngrok.zip file (see below).
Refer back to this online version if and problems following the simplified version.
Download/view the text file here:
Instructions:
- Create a free ngrok account.
The first thing to do is create an ngrok account. This is free, easy and quick.
Go to the ngrok sign-up page. Fill in your details and click on the blue Sign Up button.
2. Download the necessary files
We need to download some zip and apk files to use to install ngrok on a Firestick. Create an ngrok folder somewhere on your PC to save all these files (I create it on my desktop).
i) The scripts I have created to simplify the installation and running of ngrok on your Firestick 4K. It comes in a zip file which also includes a text file with a simplified version of these instructions, you can use to copy and paste the necessary commands.
Download here and save in the ngrok folder you created earlier on your PC. There should now be 1 file in the ngrok folder.
ii) Download the Termux android apk here and save it into the ngrok folder This is a console application we will use to setup ngrok on your Firestick 4K, as well as start the tunnel once setup. I hope to eventually create a GUI app to simplify the setup and starting of the tunnel. There should now be 2 files in the ngrok folder.
iii) An alternative keyboard to the default one on your Firestick 4K (which does not work with Termux).
Download the keyboard apk here and save it into the ngrok folder. There should now be 3 files in the ngrok folder.
iv) If you do not already have my Flakie ADB GUI app (you need version 2), download the zip here and save to the ngrok folder. There should now be 4 files in the ngrok folder.
v) If you do not already have the scrcpy ADB Remote Control application, download the zip file here and save in the ngrok folder. I have integrated scrcpy into Flakie ADB GUI which makes using it much easier. There should now be 5 files in the ngrok folder.
3. Unzip the files.
i) Unzip all the script files from the setup-ngrok.zip file you downloaded in step 2-i. Unzip them into the same ngrok folder. There are a total of 10 files in the ngrok zip file. There should now be 15 files in the ngrok folder.
ii) Create a folder on your PC for the scrcpy and Flakie ADB GUI applications and to hold the apk files. I use a folder named scrcpy on my C:\ drive (c:\scrcpy).
iii) Copy (or move) the 2 apk files (termux_0.101.apk and LeanKeyKeyboardPro_v6.0.8_origin_r.apk) to the scrcpy folder. There should now be 2 files in the scrcpy folder.
iv) Unzip the contents scrcpy-win64-v1.17.zip you downloaded in step 2-v into the scrcpy folder you just created (there are 13 files in the zip file). There should now be 15 files in the scrcpy folder.
v) Unzip the contents of the FlakieADBGUI.zip you downloaded in step 2-iv into the scrcpy folder you just created (there are 2 files in the zip file). There should now be 17 files in the scrcpy folder.
4. Upload the scripts to the sdcard/download folder on the Firestick.
To do this we will use my Flakie ADB GUI app and scrcpy. On the Firestick enable ADB Debugging and Apps from Unknown Sources in the Settings>My Fire TV>Developer Options menu. Both need to be set to ON.
You will need the local IP address of the Firestick to do this. You can get this from the Settings>My Fire TV>About>Network menu on the Firestick. Mine is 192.168.49.125.
In the scrcpy folder double-click on the FlakieADBGUI.exe file to open the app.
Use the Locate ADB button to browse to the ADB application. If you have followed all the steps so far it will be immediately available to select. Select adb.exe and click on Open.
Repeat the above steps to locate the scrcpy.exe file. Use the Locate Scrcpy button.
Enter the IP address of the Firestick into the Remote IP: box. Type 5555 into the Remote Port: box.
Now click on the checkbox Load Defaults on Start (in bottom-right of Flakie ABD GUI).
These settings will now automatically be loaded the next time you open Flakie ADB GUI. It should now look like this:
Click on the Connect ADB Device button to connect to the Firestick.
If this is the first time you have connected to the Firestick it will show as unauthorized in Flakie ADB GUI and a prompt will appear on the TV the Firestick is connected to, asking you to accept the connection. Select the box Always allow from this computer to tick it and click on OK.
Back in Flakie ADB GUI click on the Refresh Device List button so Flakie ADB GUI knows it is able to connect to it now. It will not look like this:
You are now connected to your Firestick with ADB.
In the Scrcpy and Remote Control section of Flakie ADB GUI select the Screen Resolution and Video Bit Rate for the connection. If doing this via the Internet you may have to experiment with these settings to get the best connection. I am doing this on the remote LAN so I choose the Default option for both (this gives the best resolution and bit rate). If you like you can now uncheck and then recheck the Load Defaults on Start option to save these settings for future use.
Then select the Firestick IP/Port from the Select Device box (in the Scrcpy and Remote Control section). When done it should look like this:
We are now ready to take remote control of the Firestick. Click on the Remote Control button. A window will open with the Firestick screen on it. You can interact with the window to control the Firestick without using the remote control. The window will look like this (note: it may not look exactly the same as I have a custom launcher installed on the Firestick).
We are now going to use this window to copy the ngrok scripts to the sdcard/download folder on the Firestick. Keep the scrcpy window open but move it to the right-hand side of your PC screen.
Then open the ngrok folder in a small window on the left-hand side of the screen. Select all the ngrok script files by using CTRL on your keyboard and left-click on your mouse. Select all 9 of the script files (ap, au, eu, in, jp, ngrok, sa, setup and us), then click on any of the highlighted blue area of the files and drag and drop to the scrcpy remote control window. The windows should look like this:
You may see a little +(plus) sign on the scrcpy window but other than this there is no feedback and you might think nothing has happened (but they have been copied to the sdcard). If you go back to Flakie ADB GUI and look in the scrcpy Output box you will see confirmation there that the files have been uploaded/pushed to the Firesticks sdcard/download folder.
We do not need the scrcpy window for a few minutes so you can close it now (but leave Flakie ADB GUI open and connected).
5. Install the APKs onto the Firestick.
We now need to install the Keyboard and Termux applications (apk) onto the Firestick. We will use Flakie ADB GUI to do this.
In the ADB Tools section of Flakie ADB GUI click on the Install an APK radio button.
Then click on the Locate File button. You will see both the keyboard and Termux APK files in the list. Select the keyboard file and click on Open.
Back on the ADB Tools section of Flakie ADB GUI click on Select Device box. Select you Firesticks IP/Port. The screen should now look like this:
Click on the Run Command button. The keyboard apk will be installed. After a few seconds you will receive a confirmation of the installation in the ADB Commands Output box (e.g. Performing Streamed Install. Success). The window will now look like this:
Repeat the above steps to install the Termux apk file.
6. Configure the keyboard to work with the Firestick.
We need to configure the keyboard to work on the Firestick. To do this we will use custom ADB Shell commands.
Click on the Enable Shell Command checkbox at the bottom of the ADB Tools section.
Then click on Select Device box (in the middle of the section). Select you Firesticks IP/Port.
Then copy and paste the following command into the Shell Command textbox:
adb shell ime enable com.liskovsoft.leankeyboard/.ime.LeanbackImeService
Then press Enter on your keyboard (or click the Run Shell Command button). After a couple of seconds you will get a confirmation (in the ADB Commands Output box) the keyboard input method has been enabled.
We now need to run one more custom ADB Shell command. First click on the Clear Input button and then repeat the above steps to run the following command:
adb shell ime set com.liskovsoft.leankeyboard/.ime.LeanbackImeService
After a couple of seconds you will get a confirmation (in the ADB Commands Output box) the keyboard input method has been selected.
7. Install the ngrok scripts onto the Firestick
We now need to open a scrcpy remote control window on the Firestick. Repeat the steps from above to do this.
In the scrcpy remote control window browse to the Termux application and open it.
It will install/configure itself and will open with the on-screen keyboard.
We do not need the keyboard at this time so close it with a right-click of your mouse button (or the back button on the Firestick remote control).
The window will now look like this:
We have to copy and paste 4 commands into the Termux window, one at a time.
Copy and pasting is a 3-step process.
Step 1. Select and copy the command on your Windows PC (this copies the command to the Windows clipboard).
Step 2. Open the scrcpy remote control window and press CTRL-V (this copies the command to the clipboard on the Firestick).
Step 3. Long click (click and hold) with the left-mouse button on the bottom line of the Termux window and choose paste for the pop-up menu (this pastes the command into Termux).
Do this with the following command:
termux-setup-storage
Then press Enter on your keyboard. A prompt will appear asking you to give Termux access to the media files on your Firesticks storage (sdcard).
Click on Allow when this appears. The window will look like this:
Now repeat the process with the following 3 commands, one at a time. If the keyboard pops up at any time in the process just click the right-mouse button to close it.
- To move the setup script I created to the ngrok HOME folder in Termux.
mv -v /sdcard/download/setup /$HOME - To make the script executable so we can run it.
chmod +x setup - To run the setup script. This will move all the others scripts I created (and the ngrok installation script) from the sdcard to $HOME and make them all executable.
bash setup
Now all the scripts are in the $HOME folder, are executable and the Termux application has been installed (using my setup script).
The Termux window will now look like this:
The green colour for the scripts shows they are now executable.
That is it, ngrok and all the scripts are now installed.
8. Install your ngrok authtoken into ngrok with Termux.
We have one last thing to do with the installation of ngrok. Login into your ngrok account. When logged in you should be at the ngrok Setup and Installation screen. We need to copy the line of code from the Connect your account section here. This will be used to install your ngrok authtoken into the ngrok applications configuration file.
Select the full line of code from your ngrok account. Then right click on the highlighted blue part. When selected and right-clicked on, it will look like this:
Do this and select Copy.
Then back in the Termux window, via scrcpy, press CTRL-V to copy the code to the Firesticks clipboard.
Then long-click (press and hold) with the left mouse button and choose paste from the pop-up menu.
Finally, press the Enter key on your keyboard to add the authtoken.
You will get a confirmation that the authtoken has been saved to the ngrok configuration file.
Note: If ever you reset the authtoken in your ngrok online account (in the Authentication>Your Authtoken section) you will have to repeat this step (step 8 only).
9. Start the ngrok Tunnel.
The installation is now complete. To be able to remotely connect to the Firestick you will need to start the ngrok tunnel. This is what the scripts I created and you have now installed will do. Remember the files, ap, au, eu, in, jp, sa, and us. These are scripts that will be used to start the tunnel. Each script corresponds to a region. Use the script for your region. Also if ever there is a problem with the server in your region you can attempt to use the script for another region. The regions and scripts are:
ap – Asia/Pacific
au – Australia
eu – Europe
in – India
jp – Japan
sa – South America
us – United States
Choose your region code. I am in UK so I use the Europe one (eu).
In the Termux window type: bash <region code>, where region code is the one for you region. So I would type:
bash eu
Note you can also type the shorter code: ./eu – either will work (use whichever you prefer).
After you type the code, press enter on your keyboard.
The tunnel will then start. At first it wil be a red colour as it tries to make the connection.
Then, after a few seconds, it will turn green and show connected, when the tunnel is ready for use.
10. Connect to the ngrok Tunnel.
If you have set this up up using a remote session to the Firestick using Flakie ADB GUI and scrcpy, or are in any other way connected to the Firestick using ADB then you must first close that connection. We have been using Flakie ADB GUI and scrcpy so we have to close the connection.
First close the scrcpy window.
Then in Flakie ADB GUI click on the Close All ADB button.
When the connection is closed you can continue.
Go back you your ngrok online account.
Open the page, Status>Tunnels. If it shows there are no tunnels currently online, refresh your browser (F5 should do it, or click the browser refresh button).
Your Tunnel URL should now be displayed. Select all the text in the URL section and right-click on it so you can copy it. It will look like this:
Click on copy and go back to Flakie ADB GUI.
In the ngrok connection section (bottom-right), select the Tunnel URL textbox and paste into it. If any spaces are showing at the front of the URL delete them.
You can also delete the tcp:// part if you like as this is not required. Not necessary though, as Flakie ADB GUI will strip this out for you.
The Flakie ADB GUI window will now look like this:
Finally connect to the remote Firestick by clicking on the Connect with ngrok button.
An ADB connection will be made to the remote Firestick.
The Flakie ADB GUI window will now look like this:
You can now use the tunnel with Flakie ADB GUI. All the features of Flakie ADB GUI will work through the tunnel, including scrcpy remote control sessions.
Just select the tunnel URL as the device (instead of the usual IP/Port).
11. Close the Tunnel.
It is OK to leave the tunnel running. It is secure and if no-one has the URL they cannot connect.
It is actually quite hard to close the tunnel as it is quite robust.
Even if the network disconnects, as soon as it resumes the tunnel will usual auto-connect.
If you do want to close the tunnel, this is best done by the person at the remote site.
First close any open connection with scrcpy and Flakie ADB GUI.
Then the person at the remote site can close the tunnel with the Firestick remote control, or with an attached physical or Bluetooth keyboard.
If using a physical keyboard you just have to press CTRL-C which will instantly close the tunnel.
If using the Firestick remote control it involves additional steps.
First if the on-screen keyboard is showing, close it by using the back button on the remote.
When the keyboard is closed press the Menu button on the remote.
Scroll down to Kill process (12345) – where 12345 is a random number.
The window will look like this:
Press the Select button on the remote and click OK when asked to Really kill this session.
The tunnel is now closed, but it appears it is still open.
To get rid of it we need to use the on-screen keyboard. If this is not showing you can either:
1. Press the Home button on the remote and re-open Termux. The keyboard should now be showing.
or:
2. Long-Press the Home button on the remote (which will show the ‘Apps, Sleep, Mirroring, Settings’ menu) and immediately click the back button on the remote.
Either way, the keyboard will now be showing.
Then simply scroll across to Done and click on it. The session will now clear and Termux will exit.
You can confirm the session is closed by opening Termux again.
If you want to start a new tunnel session again, using the on-screen keyboard, just use the bash region option (e.g. bash eu) . Or use ./ region option (e.g. ./eu) and press DONE on the keyboard (or you can use a physical keyboard).
Note: When you restart the tunnel you must log into your ngrok account to get the new Tunnel URL and use this in Flakie ADB GUI to connect.
Hi Flakie I follow all your steps on the ngrok and it won’t connect to the ngrok network
Any error messages? How far does it get?
I got to the part where you put in the bash and region code but it want connect
Are there any error mesages? What happens? what device is this on? I need something to go on π Can you post any screen shots anywhere, or take a pic of the screen and post it to a hosting site?
error failed to get home directory, using $HOME instead err=”user: Current not implemented on linux/arm”
Its a 4k Firestick
That is normal. As it states it is using $HOME which is what we actually want.
What happens after this or is this the last thing you see?
As it is a Firestick 4K it will definitely work as I have installed on several of them without issues π
Its a 4K Amazon FS
Did the authtoken install ok? You should have seen that message their too?
Yes it just not connecting and I dont understand why
I might install a forum where people can post and upload pics. Should make any debugging easier. Look into it now.
That is normal. As it states it is using $HOME which is what we actually want.
What happens after this or is this the last thing you see?
error failed to get home directory, using $HOME instead err=βuser: Current not implemented on linux/armβ
That is the very last line you see in the console?
Nothing following that?
I really need to a screenshot or pic of the screen.
For sure we will get this working if you can work with me a bit π
That’s all it’s say and just keep timing out
Could something on my network be stopping the connection
Possibly but don’t think thats the problem. I have added a forum. Can you take a screenshot of the error page and post it in Remote Access forum please. https://flakie.co.uk/forum/index.php
Any problems posting let me know. Only just installed and not gone through all the pemission settings yet.
How do I post my screenshots
let me check the settings to make sure it is all enabled correctly.
I have set them. Try refreshing the page. If that does not work log out and back it. Hopefully all ok now.
Comments are closed.