Cosc 5/4730 Scripting layer for Android (SL4A). Android scripting SL4A brings scripting languages to the android, by allowing you edit and execute scripts.

Slides:



Advertisements
Similar presentations
Lecture 6 Testing and Debugging on a Physical Android Device and other Power User Stuff.
Advertisements

Prerequisites Essentials of Windows 95/97 Office graphic copyright by Microsoft Corp.
Creating a Program In today’s lesson we will look at: what programming is different types of programs how we create a program installing an IDE to get.
All About Android Introduction to Android 1. Creating a New App “These aren’t the droids we’re looking for.” Obi-wan Kenobi 1. Bring up Eclipse. 2. Click.
Get android development environment running. Install – Get and install JDK 5 or 6 (see link in the.
The Android Development Environment.  Getting started on the Android Platform  Installing required libraries  Programming Android using the Eclipse.
Introduction to Visual Basic Programming. Lecture Outline History What is Visual Basic First Look at the VB 6.0 Environment Some VB Terminology Our first.
1 Mobile Computing Mobile First (formerly Worklight) Copyright 2015 by Janson Industries.
Android: Hello World Frank Xu Gannon University. Steps Configuration ▫Android SDK ▫Android Development Tools (ADT)  Eclipse plug-in ▫Android SDK and.
Google Android as a mobile development platform T Internet Technologies for Mobile Computing Olli Mäkinen.
Programming Introduction November 9 Unit 7. What is Programming? Besides being a huge industry? Programming is the process used to write computer programs.
By: Jeremy Smith.  Introduction  Droid Draw  Add XML file  Layouts  LinearLayout  RelativeLayout  Objects  Notifications  Toast  Status Bar.
2. Setting Up Your Android Development Environment.
Fundamentals of Programming in Visual Basic 3.1 Visual basic Objects Visual Basic programs display a Windows style screen (called a form) with boxes into.
ANDROID PROGRAMMING MODULE 1 – GETTING STARTED
Introduction to AppInventor Dr. José M. Reyes Álamo.
UFCFX5-15-3Mobile Device Development Android Development Environments and Windows.
Setting up the Development Environment Copyright © SUPINFO. All rights reserved Preparation.
Exploring the Basics of Windows XP
Python for S60 SmartPhones PostPC Workshop Fall 2006 Amnon Dekel.
Programming with App Inventor Computing Institute for K-12 Teachers Summer 2012 Workshop.
Exploring the Basics of Windows 8
2. Introduction to the Visual Studio.NET IDE 2. Introduction to the Visual Studio.NET IDE Ch2 – Deitel’s Book.
Test Automation For Web-Based Applications Portnov Computer School Presenter: Ellie Skobel.
Go to our website, and click on the eMedia Catalog link To find books, either click on the advanced search (which I will.
Windows Basics: Desktop, Taskbar and Window
Copyright ©: SAMSUNG & Samsung Hope for Youth. All rights reserved Tutorials Software: Building apps Suitable for: Advanced.
CS5103 Software Engineering Lecture 08 Android Development II.
“Automate Anything You See” Uses image recognition to identify and control GUI components Useful when there is no easy access to a GUI's internal or source.
May 10, 2012 Lloyd Moore, President/Owner. Quick Start Video Building Mobility 1.2 SDK Emulator Quirks Installing On A Device Summary Overview.
Getting Started with Application Software
U81X0 Downloading Tool Manual 1 ( Version 1.2 ) FlashRW For U81X0 Version 4.0.0(Build #95V) February 2004 LG Electronics Inc.
Operating system for mobile devices with a Java programming interface. Provides tools, e.g. a compiler, debugger, device emulator, and its own Java Virtual.
Introduction to Mobile Programming. Slide 2 Overview Fundamentally, it all works the same way You get the SDK for the device (Droid, Windows, Apple) You.
IE 411/511: Visual Programming for Industrial Applications
1 1 Lab1 Ismail M. Romi – IT Dept, PPU, Visual Basic 2005 Programming Tour.
Introduction to Matlab & Data Analysis
DUE Hello World on the Android Platform.
Shell Scripting Introduction. Agenda What is Shell Scripting? Why use Shell Scripting? Writing and Running a Shell Script Basic Commands -ECHO - REM.
Chapter Three The UNIX Editors. 2 Lesson A The vi Editor.
The Fundamentals of Using Windows 95. Windows 95 ã operating system that performs every function necessary for the user to communicate and control computer.
Bharathi.S. Intel® Pentium® 4, 3.6 GHz or equivalent AMD processor 500 MB free hard disk space 2 GB RAM 1 available USB 2.0 port and USB cable Microsoft®
Chapter 3 Introducing Visual Basic
Dynamic Web Pages & JavaScript. Dynamic Web Pages Dynamic = Change Dynamic Web Pages are web pages that change. More than just moving graphics around.
Microsoft Visual Basic 2005 BASICS Lesson 1 A First Look at Microsoft Visual Basic.
Themes and Menus: The Sudoku Example Content taken from book: “Hello, Android” by Ed Burnette Third Edition.
First Venture into the Android World Chapter 1 Part 2.
Lesson No: 6 Introduction to Windows XP CHBT-01 Basic Micro process & Computer Operation.
Chapter Three The UNIX Editors.
All sections to appear here Welcome to my pptPlex Slide Show, this can be executed in either two ways: 1.As a normal PowerPoint slide show: Example hit.
HTML Overview Part 5 – JavaScript 1. Scripts 2  Scripts are used to add dynamic content to a web page.  Scripts consist of a list of commands that execute.
Cosc 5/4730 Android Maps v2 Blackberry Maps. Android.
ANDROID APPLICATION DEVELOPMENT. ANDROID DEVELOPMENT DEVELOPER.ANDROID.COM/INDEX.HTML THE OFFICIAL SITE FOR ANDROID DEVELOPERS. PROVIDES THE ANDROID SDK.
Android. What is Android? A mobile device operating system. Seen primary in tablets and Cellphones. Based on a Linux kernel. Applications are Java Based.
HTC Android Projector User Guide v Agenda Setup and Demo Environment Launch Projector Installer Launch Projector Application Q&A.
Intoduction to Andriod studio Environment With a hello world program.
VB.NET and Databases. ADO.NET VB.Net allows you many ways to connect to a database. The technology used to interact with a database or data source is.
A user interface, like the one created by the DOS operating system, that makes use of typed commands.
Web Programming Java Script-Introduction. What is Javascript? JavaScript is a scripting language using for the Web. JavaScript is a programming language.
JavaScript Part 1 Introduction to scripting The ‘alert’ function.
Development Environment
CST 1101 Problem Solving Using Computers
Obtaining the Required Tools
Java on the LEGO Mindstorms EV3
Introduction to AppInventor
Android Application Development
Android Platform, Android App Basic Components
Selenium IDE Installation and Use.
Presentation transcript:

Cosc 5/4730 Scripting layer for Android (SL4A)

Android scripting SL4A brings scripting languages to the android, by allowing you edit and execute scripts and interactive interpreters directly on the device. – The scripts have access to many APIs available in applications, but simplified interface. – They can run interactively or in the background – A note, SL4A is still at the “alpha” level.

Supported languages Python, Perl, JRuby, Lua, BeanShell (a Java language based scripting language), JavaScript, Tcl, and shell (borne) More are planned to be added.

Installing Get the sl4a_r4.apk (or more current version) from scripting/downloads/listhttp://code.google.com/p/android- scripting/downloads/list Download this to your android to device, then click install For emulators, download (Google APIs), then issue the following command: – adb install sl4a_r4.apk This command can also be used to install on a your android device as well, if it is plugged via usb.

Running SL4A You should get an icon in the application launcher: This is used to open the interpreter. By default it comes with the shell scripting language. – You can now write and run shell scripts.

To install more languages In the interpreters screen select Add menu item, then select to language you want to install, say perl or python – It will then download and you will need to install the language.

To install more languages (2) You can also download the apk to the computer and install them using the adb command, example: – adb install perl_for_android_r1.apk – Click the icon and then click install.

Under the hood From Practical Android projects, Ch5 Introducing SL4A, Apress

Writing scripts. You can write scripts like you would on computers, to do many things. To access the android APIs you need the following Perl: – Use Android – my $droid = Android->new(); Python: – Import android – Droid = android.Android();

A note Actually write the scripts on the device can be difficult – Using the onscreen keyboard, plus the text can be pretty small in the editor. – Turn on the usb debugging on the device. – You can then use the following command to transfer the script over adb push script.pl /sdcard/sl4a/scripts There is also a TextEditor that maybe be very useful – Textedit-sl4a.apk You can also setup a remote connection via these directions – scripting/wiki/RemoteControl scripting/wiki/RemoteControl

Documentation and Alpha status While there are a lot of examples – In python, perl, and other languages The documentation is pretty poor. Also, since it is an alpha level program, things change with little (or no notice) between versions.

Hello World example Python import android droid = android.Android() droid.makeToast("Hello World") Perl use Android; my $a = Android->new(); $a->makeToast("Hello, Android!"); More “hello world” examples can be found here –

“Simple” Example The following uses the ttsSpeak to have the driod speak what you type into a dialog box with perl use Android; my $droid = Android->new(); $tospeak = "hi!"; while($tospeak ne "done") { $result = $droid->ttsSpeak($tospeak); $hash = $droid->dialogGetInput("Enter done to exit", "Text to Speak?"); $tospeak = $hash->{'result'}; }

APIs. scripting/wiki/ApiReference scripting/wiki/ApiReference

GUI pieces Note, this code comes from the test.pl script, installed with perl. Python has a similar script. Toast $droid->makeToast(‘Hello, Perl?’); To make the phone vibrate $droid->vibrate();

Alert Dialog my $title = 'User Interface'; my $message = 'Welcome to the ASE integration test.'; $droid->dialogCreateAlert( $title, $message ); $droid->dialogSetPositiveButtonText('Continue'); $droid->dialogShow(); my $response = $droid->dialogGetResponse()->{'result'};

GUI pieces $droid->dialogCreateAlert( $title, $message ); $droid->dialogSetPositiveButtonText('Yes'); $droid->dialogSetNegativeButtonText('No'); $droid->dialogSetNeutralButtonText('Cancel'); $droid->dialogShow(); my $response = $droid->dialogGetResponse->{'result'}; my $which = $response->{'which'}; Results use these keys 'positive', 'negative', 'neutral';

Spinner Progress dialog my $title = 'Spinner'; my $message = 'This is simple spinner progress.'; $droid->dialogCreateSpinnerProgress( $title, $message ); $droid->dialogShow(); sleep 2; #so the spinner stays up for 2 seconds. $droid->dialogDismiss();

Horizontal Progress bar $title = 'Horizontal'; $message = 'This is simple horizontal progress.'; $droid->dialogCreateHorizontalProgress( $title, $message, 50 ); $droid->dialogShow(); for my $x ( ) { sleep 1; $droid->dialogSetCurrentProgress($x); } $droid->dialogDismiss();

Dialog with a list my $title = 'Alert'; $droid->dialogCreateAlert($title); $droid->dialogSetItems( [ qw/foo bar baz/ ] ); $droid->dialogShow(); my $response = $droid->dialogGetResponse()- >{'result'};

Dialog with a choice list my $title = 'Alert'; $droid->dialogCreateAlert($title); $droid->dialogSetSingleChoiceItems( [ qw/foo bar baz/ ] ); $droid->dialogSetPositiveButtonText('Yay!'); $droid->dialogShow(); my $response = $droid->dialogGetResponse()->{'result'};

Dialog with Multi Choice list my $title = 'Alert'; $droid->dialogCreateAlert($title); $droid->dialogSetMultiChoiceItems( [ qw/foo bar baz/ ], [] ); $droid->dialogSetPositiveButtonText('Yay!'); $droid->dialogShow(); my $response = $droid->dialogGetResponse()->{'result'};

References Introducing SL4A: The scripting layer for android, Pieter Greyling – scripting.googlecode.com/files/Practical_Android_ Projects_Ch05_Introducing_SL4A.pdf scripting.googlecode.com/files/Practical_Android_ Projects_Ch05_Introducing_SL4A.pdf