Get the name of the current Android activity.

Usage

                    .appium.getCurrentActivity([callback])
                

Example

module.exports = {
  'get current activity name': function (app) {
    app
      .appium.getCurrentActivity(function (result) {
        console.log('current android activity is:', result.value);
      });
  },

  'get current activity name with ES6 async/await': async function (app) {
    const activity = await app.appium.getCurrentActivity();
    console.log('current android activity is:', activity);
  }
};

Parameters

Name Type description
callback
Optional
function

Callback function which is called with the result value.

Returns

Type description
string

Name of the current activity.

See also