Remote ADB with Mason X-Ray
Our goal at Mason is to make the process of building, scaling, and managing fleets of dedicated Android devices seamless. One of the biggest challenges and cost drivers companies face related to the management of their device fleets is troubleshooting issues experienced in the field. At Mason, we’ve developed tools for you to customize the OS, helping minimize the number of issues you encounter by solving one of the root problems — Android fragmentation. But unfortunately, there’s no such thing as perfect software, and you’re bound to run into unexpected behavior, app crashes, and user error that drive up support requests.
So we asked ourselves, what can we do to help streamline our customer’s support process?
In the Android world, one of the most powerful tools to help troubleshoot issues is Android Debug Bridge (ADB). However, there are two key requirements that need to be met to make troubleshooting via ADB useful:
- You need to have physical access to the device to plug it in
- You need to be able to access the device in near-real-time (otherwise logs might get erased or overwritten)
Unfortunately, when dealing with smart products, where you can have thousands of dedicated devices deployed globally, meeting these two requirements becomes almost impossible, which can then create massive support headaches. After hearing about the pains this causes our customers and the related support costs, we decided to tackle this issue head on.
As a result, we’re extremely excited to announce a new feature we’re calling X-Ray, with the first version supporting the ability to remotely use ADB and interact with any device in your fleet. Read more about X-Ray below.
What is X-Ray?
NOTE: X-RAY IS ENABLED BY DEFAULT WITH MASON OS 2.9.0. IF WANT TO DISABLE THIS, MAKE SURE YOU DEPLOY A PROJECT WITH X-RAY DISABLED IN THE CONFIG.
X-Ray lets you remotely execute ADB commands, such as copying or pushing files, installing/uninstalling apps, initiating a shell, etc. However, there are four aspects that make our X-Ray feature unique:
- You can use it remotely, meaning you don’t need to physically access the device or require a wired connection.
- You can use it in real time, allowing you to see logs or interact with the device as issues are happening.
- You can use it programmatically, so you can run commands across large groups of devices with ease.
- It’s securely enabled by default, meaning you don’t have to turn on developer options.
Keep an eye out for future releases that will let you remotely view and control devices!
Getting Started with X-Ray
Ready to test this out for yourself? Follow the steps below to get started, or check out our docs for some detailed instructions.
Before you start using X-Ray, you’ll need the following:
- A Mason Account
- Mason CLI version v1.5+
- A device running Mason OS 2.9.x+. If you don’t have a device, create a free Mason account and place an order for a Dev Kit via the Mason Controller. You can also contact email@example.com if you have any questions, or want a full demo of Mason.
- An API Key with the FLEET:ADMIN scope. You can create a key from the Mason Controller.
- A target device’s DEVICE_ID info. You can find a device’s ID from the devices page in the Mason Controller.
Once you’ve met the above requirements, you can use the CLI to run mason xray to get started. Check out the FAQ below or our docs for some examples to get you started.
Can I disable X-Ray?
Yes – if you don’t want devices in your fleet to have remote ADB enabled, you can add a setting to your project.
Can I test out X-Ray without a Dev Kit?
Does X-Ray require the end-user to opt-in?
No, the end user does not need to opt-in for remote ADB to be enabled.
Do I need to worry about user privacy?
Because each customer can dictate what information is logged, we cannot say for sure if user privacy is a concern. You should consult your legal and engineering team regarding any privacy concerns.
Do I have to have ADB enabled via the developer options?
No, you also do not need ADB enabled via developer options, so you can keep your devices secure while still having the access and control you need.
What are examples of things I can do with X-Ray?
- Mason xray logcat lets you stream logs from a device.
- Masn xray install allows you to install an apk
- Mason xray uninstall allows you to uninstall an apk
In our CLI, you can also run mason xray to get a full list of available commands. We’ll be continually updating this over the next few weeks as well – so keep checking back for more fun with xray!