Android::ElectricSheep::Automator::Plugins::Viber - Control the Viber app from your desktop via the ElectricSheep Automator

- NAME
- VERSION
- WARNING
- SYNOPSIS
- CONSTRUCTOR
  - new($params)
- METHODS
- AUTHOR
- BUGS
- SUPPORT
- SEE ALSO
- HUGS
- LICENSE AND COPYRIGHT

# NAME

Android::ElectricSheep::Automator::Plugins::Viber - Control the Viber app from your desktop via the ElectricSheep Automator

# VERSION

Version 0.02

# WARNING

Current distribution is extremely alpha. API may change.

# SYNOPSIS

An Android::ElectricSheep::Automator plugin which interacts with the Viber app from the desktop.

    use Android::ElectricSheep::Automator::Plugins::Viber;

    my $viber = Android::ElectricSheep::Automator::Plugins::Viber->new({
      'configfile' => $configfile,
      'verbosity' => 1,
      # we already have a device connected and ready to control
      'device-is-connected' => 1,
    });

    # go to home screen to start fresh
    $plugobj->mother->home_screen();

    # open the viber app
    $plugobj->open_viber_app() or die

    $plugobj->send_message({
        'recipient' => 'My Notes', # some of your contacts
        # 1) no unicode, 2) each space must be converted to '%s'
        'message' => 'thank%syou'
    }) or die;

# CONSTRUCTOR

## new($params)

Creates a new `Android::ElectricSheep::Automator::Plugins::Viber` object. `$params` is a hash reference used to pass initialization options. These options are passed onto the main constructor. Refer to the documentation of Android::ElectricSheep::Automator::new($params) for

A configuration file or hash is required.

Here is an example configuration file to get you started:

    </* $VERSION = '0.01'; */>
    </* comments are allowed */>
    </* and <% vars %> and <% verbatim sections %> */>
    {
          "Android::ElectricSheep::Automator" : {
                  "adb" : {
                          "path-to-executable" : "/usr/local/android-sdk/platform-tools/adb"
                  },
                  "debug" : {
                          "verbosity" : 0,
                          </* cleanup temp files on exit */>
                          "cleanup" : 1
                  },
                  "logger" : {
                          </* log to file if you uncomment this */>
                          </* "filename" : "..." */>
                  }
                  </* config for our plugins (each can go to separate file also) */>
          },
          "Android::ElectricSheep::Automator::Plugins::Viber" : {
          }
    }

All sections are mandatory. Setting `"adb"` to the wrong path will yield in problems.

# METHODS

open_viber_app()

  It opens the viber app.

  It returns `undef` on failure or a hash of information about the app on success.

close_viber_app()

  It closes the viber app. Whether it kills it or it puts it in the background or ... depends on the Android version.

send_message($params)

  It sends a message to one of your contacts.

  It returns `undef` on failure or a hashref on success.

  `$params` is a HASH_REF which may or should contain:

  `recipient`

    Required name of the recipient which must be in your contacts. (Note, I am not sure if a recipient not in the contacts can still be used).

  `message`

    Require, the message to send. At the moment the message can not be unicode. And it can not contain any space character unless it is encoded as `%s` .

  `mock`

    Optionally, set this flag to `1` in order to do everything except hitting the send button. No message will be sent. For debugging purposes.

  `outbase`

    Optionally, specify the basename to form filenames for saving UI dumps. For debugging purposes.

  It needs that connect_device() to have been called prior to this call.

  It returns `undef` on failure or an (empty) hash on success.

navigate_to_viber_home_activity($params)

  It navigates to the viber app's home screen. E.g. if you are in your contacts screen, calling this method will land you to the app's home screen. It achieves this by continually pressing the app's back-button (the left arrow at the top) until it arrives at the home screen of the viber app.

  It returns `1` on failure or a `0` on success.

  `$params` is a HASH_REF which may or should contain:

  `outbase`

    Optionally, specify the basename to form filenames for saving UI dumps. For debugging purposes.

  It needs that connect_device() to have been called prior to this call.

  It returns `1` on failure or `0` on success.

# AUTHOR

Andreas Hadjiprocopis, `<bliako at cpan.org>`

# BUGS

Please report any bugs or feature requests to `bug-Android-ElectricSheep-Automator at rt.cpan.org`, or through the web interface at https://rt.cpan.org/NoAuth/ReportBug.html?Queue=Android-ElectricSheep-Automator. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.

# SUPPORT

You can find documentation for this module with the perldoc command.

    perldoc Android::ElectricSheep::Automator::Plugins::Viber

You can also look for information at:

- RT: CPAN's request tracker (report bugs here)

  https://rt.cpan.org/NoAuth/Bugs.html?Dist=Android-ElectricSheep-Automator

- AnnoCPAN: Annotated CPAN documentation

  http://annocpan.org/dist/Android-ElectricSheep-Automator

- Search CPAN

  https://metacpan.org/release/Android-ElectricSheep-Automator

# SEE ALSO

- Android::ADB is a thin wrapper of the `adb` command created by Marius Gavrilescu, `marius@ieval.ro`. It is used by current module, albeit modified.

# HUGS

- Πτηνού, my chicken, now laying in the big coop in the sky ...

# LICENSE AND COPYRIGHT

This software is Copyright (c) 2025 by Andreas Hadjiprocopis.

This is free software, licensed under:

    The Artistic License 2.0 (GPL Compatible)