Android-ElectricSheep-Automator
view release on metacpan or search on metacpan
of these e.g. audio or hardware or an extended regular expression
that Android's pgrep understands, e.g. ^com.+google.+mess.
It returns undef on failure or an ARRAY_REF containing a HASH_REF of
data for each command matched (under keys pid and command). The
returned ARRAY_REF can contain 0, 1 or more items depending on what was
matched.
geofix($params)
It fixes the geolocation of the device to the specified coordinates.
After this, app API calls to get current geolocation will result to
this position (unless they use their own, roundabout way).
$params is a HASH_REF which should contain:
* latitude
the latitude of the position as a floating point number.
* longitude
electric-sheep-dump-ui.pl --configfile config/myapp.conf --output ui.xml
Note that it constructs a regular expression from escaped user input.
electric-sheep-dump-current-location.pl
Dump the GPS / geo-location position for the device from its various
providers, if enabled.
electric-sheep-dump-current-location.pl --configfile config/myapp.conf --output geolocation.json
electric-sheep-emulator-geofix.pl
Set the GPS / geo-location position to the specified coordinates.
electric-sheep-dump-ui.pl --configfile config/myapp.conf --latitude 12.3 --longitude 45.6
electric-sheep-dump-screen-shot.pl
Take a screenshot of the device (current screen) and save to a PNG
regular expression that Android's `pgrep` understands, e.g.
`^com.+google.+mess`.
It returns `undef` on failure or an ARRAY\_REF containing
a HASH\_REF of data for each command matched (under keys `pid` and `command`).
The returned ARRAY\_REF can contain 0, 1 or more items depending
on what was matched.
## **`geofix($params)`**
It fixes the geolocation of the device to the specified coordinates.
After this, app API calls to get current geolocation will result to this
position (unless they use their own, roundabout way).
`$params` is a HASH\_REF which should contain:
- **`latitude`**
the latitude of the position as a floating point number.
- **`longitude`**
Dump the current screen UI as XML to STDOUT or to a file:
electric-sheep-dump-ui.pl --configfile config/myapp.conf --output ui.xml
Note that it constructs a regular expression from escaped user input.
## **`electric-sheep-dump-current-location.pl`**
Dump the GPS / geo-location position for the device from its various providers, if enabled.
electric-sheep-dump-current-location.pl --configfile config/myapp.conf --output geolocation.json
## **`electric-sheep-emulator-geofix.pl`**
Set the GPS / geo-location position to the specified coordinates.
electric-sheep-dump-ui.pl --configfile config/myapp.conf --latitude 12.3 --longitude 45.6
## **`electric-sheep-dump-screen-shot.pl`**
Take a screenshot of the device (current screen) and save to a PNG file.
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
print $FH $jsonstr;
close $FH;
}
return {
'raw' => $contents,
'json' => $jsonstr,
'perl' => \%psdata
}
}
# ONLY FOR EMULATORS, it fixes the Geolocation to the
# specified coordinates (with 'latitude' and 'longitude').
# returns 1 on failure, 0 on success
# it needs that connect_device() to have been called prior to this call
sub geofix {
my ($self, $params) = @_;
$params //= {};
my $parent = ( caller(1) )[3] || "N/A";
my $whoami = ( caller(0) )[3];
my $log = $self->log();
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
=back
It returns C<undef> on failure or an ARRAY_REF containing
a HASH_REF of data for each command matched (under keys C<pid> and C<command>).
The returned ARRAY_REF can contain 0, 1 or more items depending
on what was matched.
=head2 B<C<geofix($params)>>
It fixes the geolocation of the device to the specified coordinates.
After this, app API calls to get current geolocation will result to this
position (unless they use their own, roundabout way).
C<$params> is a HASH_REF which should contain:
=over 4
=item * B<C<latitude>>
the latitude of the position as a floating point number.
lib/Android/ElectricSheep/Automator.pm view on Meta::CPAN
Dump the current screen UI as XML to STDOUT or to a file:
electric-sheep-dump-ui.pl --configfile config/myapp.conf --output ui.xml
Note that it constructs a regular expression from escaped user input.
=head2 B<C<electric-sheep-dump-current-location.pl>>
Dump the GPS / geo-location position for the device from its various providers, if enabled.
electric-sheep-dump-current-location.pl --configfile config/myapp.conf --output geolocation.json
=head2 B<C<electric-sheep-emulator-geofix.pl>>
Set the GPS / geo-location position to the specified coordinates.
electric-sheep-dump-ui.pl --configfile config/myapp.conf --latitude 12.3 --longitude 45.6
=head2 B<C<electric-sheep-dump-screen-shot.pl>>
Take a screenshot of the device (current screen) and save to a PNG file.
script/electric-sheep-dump-current-location.pl view on Meta::CPAN
if( defined $OUTFILE ){
my $FH;
open($FH, '>', $OUTFILE) or die "$0 : failed to open output file '$OUTFILE' for writing, $!";
print $FH $jsonstr;
close $FH;
} else { print STDOUT $jsonstr }
print STDOUT "$0 : done, success!".(defined($OUTFILE)?" Output written to file '$OUTFILE'.\n":"\n");
sub usage {
return "Usage $0 --configfile CONFIGFILE [--output geolocation.json] [--device DEVICE] [--verbosity v]\n"
. "\nThis script will dump the current location of the device, for all its providers, as JSON.\n"
. "\nExample:\n"
. "$0 --configfile config/myapp.conf --output geolocation.json\n"
. "\nProgram by Andreas Hadjiprocopis (c) 2025 / bliako at cpan.org / andreashad2 at gmail.com\n\n"
;
}
1;
( run in 1.348 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )