This is a discussion topic for the original post at Automating Android Apps - Botcity | Blog
When we think about process automation, we immediately think about Desktop and Web. This happens because the vast majority of processes to be automated are available through web pages or are in applications that run on more common and consolidated operational systems such as Windows.
With digitalization and the increasing need for mobility and portability, we have the emergence of several applications for mobile devices, especially in Android environments, and the possibility of automating mobile environments becomes increasingly necessary.
Automation in Android Environments
In the case of Selendroid, despite its compatibility with different versions of Android, it is only possible to automate one app at a time in addition to requiring special permissions in the application.
Appium, the most used framework for mobile automations, requires the configuration of an HTTP server as well as the usage of UIAutomator driver to translate the automation commands. Moreover, Appium does not support older versions of Android making it necessary to use other tools to automate legacy versions.
Using the BotCity framework it is possible to build complete automations of applications and processes on an Android system, quickly and in a very simplified way, similarly to how it is done in Desktop applications, mimicking the experience of a human user.
Accessing Android Environments
As an alternative to accessing an Android system, we can use tools that mirror the screen of a given device, such as Team Viewer. Or tools that emulate a complete Android system, such as Blue Stacks or Android Emulator, the emulator used in the Android Studio IDE.
TeamViewer uses an Android app and a Desktop app that connects to the device through an ID provided by the app. The device screen is mirrored and it can be accessed through the Desktop.
The Android Emulator simulates devices on your computer, enabling you to access and test different devices and applications without having a physical device.
Similarly to Android Emulator, BlueStacks is a simulator in which you can emulate an Android system without the need for a real device. Simply installing the emulator it is possible to have access to a complete environment without the need to make specific configurations.
In this way, using a tool that provides access to an Android environment and leveraging the BotCity Desktop Framework we can automate any Android application.
In this article we will use BlueStacks to build a basic example and demonstrate how the Desktop Bot works to automate an Android application.
A Practical Example
For this example, you will need Python 3.7 or newer as well as the Blue Stacks emulator, which you can download using this link.
After downloading, install the Blue Stacks emulator. The installation does not require specific configurations, just follow the steps in the installer and at the end the environment will be ready for use.
Note that you can adjust the display settings as you see fit. For this example the default Blue Stacks settings are being used.
In this example, we will automate the process of filling out a form using the Jotform application. For that we will get the application from the Play Store and create the example form using the Information Request template.
With everything installed and the environment already configured, let’s create a new Python project of the Desktop Bot type using the project template through the CookieCutter command. You can find information on how to create a new project at this link.
The code we will use in our example basically finds the form fields and fills them with the data.
We won’t be diving into the code details for this example but you can see how it looks like on the snippet below.
You can download the code for this example clicking here and visiting the BotRepository.
In this article, we covered strategies to develop automations in Android systems and the existing alternatives to access and configure this type of environment. With a small example we were able to show that the BotCity framework is also capable of operating on Android systems with ease. In a few steps you can access the environment and automate basically any application or process in the same way as for Desktop applications. This becomes a great alternative if an application or a certain process can only be accessed via an Android device.