How to identify the Hybrid application programmatically?

Android mobile application comprised of two different types, one is Native application and another one is Hybrid application. Each type of application is having some merits and de-merits. Hybrid Application is a combination of both the Native and Web components. Web elements associated with the Hybrid application will re-use the web browser container for displaying the elements in the expected fashion. Hybrid application is developed using the HTML, CSS and Javascript. Native application is developed for the specific platform and it is having all the privilege and permissions to access the system features such as camera, GPS, SMS etc,. Please note, debugging option should be enabled by the Android developer for the Hybrid mobile application.

Using the Java program, we are going to identify the Android mobile application type as stated above and check whether it is a Hybrid app or not.


1. Download the latest Appium Client Libraries using the URL:

2. Map the required libraries in the Eclipse IDE based on the step-3 URL

3. Refer the blog post to configure and implement Appium using the URL:

Steps to follow;

1. Initialize the AndroidDriver available in the Appium client libraries –;

2. Get the mobile app screen/activity context by using the method getContextHandles() using the driver object instantiated from AndroidDriver

3. If the context name is webview, it should be a Hybrid application

4. If the context name is Native_APP, it should be a Native application


public class HybridAppCheck {

AndroidDriver<WebElement> driver;

public void contextCheck() {

Set<String> contextNames = driver.getContextHandles();

for (String contextName : contextNames) {

if (contextName.contains(“WEBVIEW”))




If you want to change the context of the mobile app activity back to Native, please use the below step;


Happy Coding!!!



Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s