Sha256: 7fc8ecae6573906bbcc42f886f4a972f9558018745953e10acb40aa2f7cef8d5

Contents?: true

Size: 1.06 KB

Versions: 2

Compression:

Stored size: 1.06 KB

Contents

module Calabash
  module Android
    module LifeCycle
      # Resume an application. If the application is already focused, nothing
      # will happen.
      #
      # @example
      #  go_home
      #  # Do something
      #  resume_app
      #
      # @param [String, Calabash::Application] path_or_application A path to the
      #  application, or an instance of {Calabash::Application}.
      #  Defaults to
      #  {Calabash::Defaults#default_application Calabash.default_application}
      def resume_app(path_or_application = nil)
        path_or_application ||= Application.default

        unless path_or_application
          raise 'No application given, and Application.default is not set'
        end

        Device.default.resume_app(path_or_application)

        true
      end

      # @!visibility private
      def _send_current_app_to_background(for_seconds)
        package = focused_package
        activity = focused_activity

        go_home
        sleep(for_seconds)
        Device.default.resume_activity(package, activity)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
calabash-2.0.0.pre2 lib/calabash/android/life_cycle.rb
calabash-2.0.0.pre1 lib/calabash/android/life_cycle.rb