I needed to perform a demo of a tool where I would utilize my mobile device (phone) to perform an action, and it caused a reaction on my laptop. Â However, part of the “WOW” factor is to mirror my mobile device screen onto my laptop so the viewer can see both the mobile device and the web browser.
Thanks to Apple’s AirPlay this is relatively easy for the iPhone with the purchase of 3rd part software like Air Squirrels Reflector, but I don’t have an iPhone. (I can never figure out how to switch between apps, or how to go back if the app developer didn’t include a back button in the app. Â But I digress.)Â Instead I have an Android device, which has a much larger user base, and I really didn’t want to switch. Â Unfortunately nobody has created a 3rd party application that utilizes the Cast Screen functionality of Android in the same manner as the AirPlay.
In searching I found many solutions that required the user to “root” their mobile device. Â This really wasn’t an option for me. Â I have a Google Nexus device, so I’m not really held back by mobile vendor limitations, lock downs, or pre-installed software. Â No need to “root” my device. Â I’ve rooted/unlocked other mobile devices in the past, and since I’m not a mobile developer, I feel no need to tinker with what works for me.
I did manage to find a couple other solutions (one with the help of my co-workers) that did work without altering my device software, or installing applicationsÂ on my laptop. Â Well, that is not entirely true. Â Both of the solutions I’m about to share did require the Java runtime environment to be installed, but I consider that a mute point since most computers these days already have it installed for one reason or another. (Most developer IDE’s already require it, so I already had it.)
Step 1 – Ensure you have JRE
As I said, for this to work you will need to have the Java Runtime Environment of some sort installed on your system. Â If you don’t already have the JRE installed you can do it at http://java.com.
Step 2 – Connect with USB
You must connect your Android device to your PC via USB connection for this to work. Â As of this writing I have not found a way to make this wireless.
Step 3 – Enable Developer Mode
By default Android devices do not come with Developer Mode enabled.Â This mode is needed so we can take advantage of debugging via USB tether.
On Android devices prior to 4.2 you could set USB Debugging from the settings…easy-peasy.
To enable this on Android 4.2+ go into Settings->AboutPhone and tap the Build Number 7 times.Â The device will inform you that Developer Mode is now enabled.Â Click back to hit the previous screen and you will now see Developer Options available.Â Check the box for USB Debugging and you’re done.
Step 4 – Download the Android developer tools
For simplicity sake I only downloaded the standalone Android SDK Tools Only. (I had no use for the Studio.) I did this at the URL http://developer.android.com/sdk/index.html#Other, then unzipped the file to a place of my liking.
After making the file ‘/tools/android’ executable I ran it on the system.Â This opens the Android SDK Manager window.Â The purpose for this is to download and install the needed packages to allow us to “develop” Android apps.Â I didn’t change a thing and simply clicked the button that said “Install n packages”. (Note: n will be some sort of number.)
It took awhile for the manager to do the update/download, but after it was completed I simply closed it.Â This would have downloaded a bunch of things, but the most important for us is ‘/platform-tools/adb’ which is required to mirror our device screen to the PC. (Make sure this file is executable as well.)
Step 5 – Add locations to the PATH
For this screen sharing to work you will need to add two folders of the Android SDK to your PATH: ‘/platform-tools’ and ‘/tools’.Â I did this by editing my .bashrc file as follows:
Step 6 – Download Apps
There are two possible apps to use to do this:
- Android-Screen-Monitor – https://code.google.com/p/android-screen-monitor/
- Droid @ Screen – http://droid-at-screen.ribomation.com/
Both carry the same sorts of functionality, however Droid @ Screen is a bit more mature and makes additional options a little easier.Â One thing I didn’t like was the need to have an extra window open for the settings.Â Due to my being a fan of simplicity I have been using Android-Screen-Monitor.
Both apps are a simple matter of executing the jar file using java and they just work.
Step 7 – Launch it!
Now it is simply a matter of launching either the Android-Screen-Monitor or Droid@Screen application. I did this via CLI like so:
$ java -jar asm.jar
NOTE: This command assumes we changed directory to where we downloaded the Android-Screen-Monitor jar file.
If you have questions or comments please post them.Â I will return to this post and tweak it a bit more to become really easy to use, but for now this is mostly what I did.