If you can't read please download the document
Upload
xsawyer
View
6.661
Download
0
Embed Size (px)
Citation preview
When Perl met Android
About me
Sawyer X
Sysadmin / Perl Ninja
http://search.cpan.org/~xsawyerx/
http://blogs.perl.org/users/sawyer_x/
What is Android?
GNU/Linux-based operating system
Developed by Google for mobile devices
Java UI framework.
Some statistics
Smartphone OS first quarter of 2010 in the US:BlackBerry OS holds 36% - 1st place
Android holds 28% - 2nd place
iOS holds 21% - 3rd place.
[NPD Group study]
Some more statistics
2nd most popular mobile development target
Over 70,000 apps available for Android
About 60K Android devices sold daily, about 22M a year
About 60% of Android Apps are free compared to iPhones 25%
U.S. make up 65% of Android devices.
Features
Free
Linux-based
Open source
Community-driven
Pretty UI
Well supported
Has an emulator.
Obstacles
Java.
Java..
Java...
Enter SL4A (previously ASE)
Scripting Layer for Android
(Formerly ASE: Android Scripting Environment)
Java bridge between interpreters and Android
JSON RPC server
Serializes object methods and params to JSON
Root required for new interpreters
Supports Python, JRuby, Perl, Lua, Javascript...
6 lines for a barcode scanner!
Stuff you can do
TTS (Text To Speech)
Dialogs (input, alert, selections, progress, etc.)
GPS, ringer mode, airplane mode, etc.
Sensors, vibrators, etc.
Data on the phone (contacts, SMS msgs)
Run servers in the background(Stevan got Plack running!)(I got Dancer running!)
How does the code look?
Android.pm (written by Jarkko Hietaniemi)
Provides an object
Uses AUTOLOAD to provide any API method
Returns hash with results (errors, msgs, etc.)
use Android;my $droid = Android->new;$droid->speak(Hello from Perl!);
GPS-based messaging (Alex Elder)
You set GPS coordinates
An SMS msg and a contact
It sends the SMS when you reach the location
Supports tags (such as country name)
Roughly 90 lines of code in a single file
Would have helped me avoid my first ticket.
Where do I start?
Download and install Android SDK
Create a virtual device
Install SL4A
Add a Perl interpreter
Write your script
Upload it to the virtual device
Run, Forest... RUUUUUN [the script] !!