SlideShare a Scribd company logo
1 of 44
Download to read offline
Android as a Digital Signage platform

Betabeers Barcelona November 2013
Hello world
The company

Clients

20 people

Orange

Digital Signage

El Corte Inglés

User Interactivity

Endesa
Sodexo

Projects
Spain
United Kingdom
Germany
Netherlands
Finland

www.focusonemotions.com
@focusonemotions

Ikea
Nespresso
Fira Barcelona
Ajuntament de Barcelona
ESADE
The Phone House
Hello world
Orestes Carracedo
8 years as a developer
4 years as an Android user
3,5 years at Focus On Emotions
Software Development Director
Certified SCRUM Master
PHP 5.3 Zend Certified Engineer

Read about me
http://blog.orestes.io

Follow me
@orestesCA
What’s Digital Signage?
What’s Digital Signage?
The beginning
Briefing
Make it on time
Code as less as possible

Be robust
Make use of existing OS tools
Make use of existing apps

Be flexible
Create multiple decoupled tools that work together
System architecture
Apache Cordova

A
D
B

API Client

JavaScript player
V
P
N

cron

scheduler

SuperSU
BusyBox

HTTP API

S
S
H

CLI API
Prototype

http://vimeo.com/72032877
Let’s do it!
Quick ADB recap
$ adb devices
List of devices attached
4df144cb39376f2f
device # Over USB
192.168.1.42:5555
device # Over NET
$ adb shell echo “Hello world”
Hello world
$ adb -d shell ls /mnt/sdcard
$ adb -s 192.168.1.42:5555 shell ls /mnt/sdcard

Enable ADB over Wi-Fi
$ adb shell setprop service.adb.tcp.port 5555
$ adb shell stop adbd && start adbd # or you’ll be locked out
$ adb connect 192.168.1.42:5555
Quick ADB recap
Sending keys
$ adb shell input keyevent 3 # home
Starting activities
$ adb shell am start -n com.focusonemotions.android.player./Wrapper
Killing a process
$ pm stop com.focusonemotions.android.player
Installing apps
$ adb install foe-player-v1.1.apk
$ adb push foe-player-v1.1.apk /system/app

Android Monitor
<android-sdk>/tools/monitor
http://developer.android.com/reference/android/view/KeyEvent.html
Features
Player
Cordova
Rotates screen
Shows WebView
Provides OS shell access

JavaScript
Displays content
Reads content index file
Listens for gesture
Asks for security code
Shows config manager
Scheduler
Power management
$ reboot # (duh)
Screen state management
$ input keyevent 26 # power
$ input keyevent 82 # menu
Player state management
$ killall com.focusonemotions.android.player
$ am start -n com.[...].player/.Wrapper

http://developer.android.com/reference/android/view/KeyEvent.html
Restricted user access
●

Kill UI process
● Custom launcher
AndroidManifest
<category android:name="android.intent.category.HOME" />

/system/build.prop
qemu.hw.mainkeys=1

●

Custom ROM

http://thebitplague.wordpress.com/2013/04/05/kiosk-mode-on-the-nexus-7/
Local configuration manager
Content Index file

Configuration manager

Player configuration file

Content player
Static IP address

$ openvpn --config /mnt/sdcard/focus/openvpn/conn.conf >
/mnt/sdcard/focus/openvpn/run.log &
$ cat /mnt/sdcard/focus/openvpn/conn.conf | grep resolv
resolv-retry infinite

https://play.google.com/store/apps/details?id=de.schaeuffelhut.android.openvpn.installer
https://play.google.com/store/apps/details?id=de.blinkt.openvpn
Remote shell
$ adb connect 192.168.1.42:5555
.
.

$ time adb connect 192.168.1.42:5555
unable to connect to 192.168.1.42:5555
real
user
sys

1m3.163s
0m0.000s
0m0.020s

$ time timeout 9s adb connect 192.168.1.42
real
user
sys

0m9.003s
0m0.000s
0m0.020s
Screen capture
$ adb shell screencap /mnt/sdcard/focus/capture.png
$ adb pull /mnt/sdcard/focus/capture.png
$ ./capture.sh oratab-030-01
Getting screencap from oratab-030-01 ... done.
Wi-Fi management
$ echo "12345678" | wpa_passphrase "SSID"
# reading passphrase from stdin
network={
ssid="SSID"
#psk="12345678"
psk=34b59e6b0182725d42460 [...]
}
$ wpa_passphrase "SSID" "12345678" # may malfunction
$ wpa_passphrase "SSID" # may malfunction
# reading passphrase from stdin

Android Wi-fi/WPA settings
/data/misc/wifi/wpa_supplicant.conf
Content management
$ adb push /local/folder /remote/folder

PHP SFTP Wrapper

/mnt/sdcard/focus
+ openvpn
+ player

$ php load-device-content.php 300 7

+ scheduler

Loading content …

+ upload

50 % 20/40 KB
100 % 40/40 KB
Done.

- content
- october_2013
+ media
Statistics & graphs
Statistics & graphs
Whisper database (updates to past data)
Carbon aggregation (Use an IP, not a hostname UDP is better than TCP, is off by default)
Graphite for rendering
$ /opt/graphite/bin/carbon-cache.py start --debug
$ echo ‘value.received’ `date +%s` | nc -w 1 127.0.0.1 2003

StatsD/statsite as aggregator/proxy (v8 nodejs vs C)
<?php StatsD::increment(‘com.focusonemotions.app.pushing’);

http://graphite.readthedocs.org/en/latest/
https://github.com/etsy/statsd/
https://github.com/armon/statsite
Platforming
Platforming
1.
2.
3.
4.
5.

Plug device in
Enable ADB over USB
Launch script
Enter ID
Done!

Check
●
●
●
●

PING
SFTP
SSH
ADB
Platforming
Install SuperSU + settings
Install BusyBox
Install DropBearSSH
Fix SFTP subsystem
Install player
Install scheduler
Install OpenVPN certificates from ID
Reboot
$ sftp root@192.168.1.42:mnt/sdcard/focus
bash: /usr/libexec/sftp-server: No such file or directory
$ sftp -s /system/xbin/sftp-server root@192.168.1.42:mnt/sdcard/focus
sftp>
# quick fix
[adb] $ ln -s /system/xbin/sftp-server /usr/libexec/sftp-server
http://www.chainfire.eu/projects/52/SuperSU/
https://play.google.com/store/apps/details?id=stericson.busybox
https://github.com/yath/android_external_dropbear
Content Management System
Testing
Testing
Quick feedback
Acceptance Tests
● CLI API
● Web API
Physical testing devices
Testing
Scenario Outline: Get a list of cities based on the passed parameters
Given I have an endpoint "http://api.pushmaster.focusonemotions.com/1.0/city/"
And I pass an argument "id" "<id>"
And I pass an argument "title" "<title>"
When I make a "<method>" request to the endpoint
Then I should get a valid response "<response>"
Examples:
| method
| GET
| GET
| GET
| GET
| GET

| id | title
|
|
| 1 |
|
| Hobbiton
| -1 |
|
| FOO

|
|
|
|
|
|

response
city/city-list.json
city/city-get-by-id.json
city/city-get-by-title.json
null.json
null.json

|
|
|
|
|
|
All done
Ha ha!
Monitoring with Nagios
Monitoring with Nagios
$ php check-device-content.php 192.168.1.42
Up-to-date
$ php check-device-content.php 192.168.1.42
Out of date

http://nagios.sourceforge.net/docs/3_0/quickstart.html
Monitoring with Nagios
<?xml version="1.0" encoding="UTF-8"?>
<nagios_status>
<hosts>
<host name="dev-001">
<status last_change="2013-10-08T16:27:37+02:00">0</status>
<connectivity last_change="2013-10-08T16:27:37+02:00">0</connectivity>
<content last_change="2013-10-08T16:27:37+02:00">0</content>
<sftp last_change="2013-10-08T16:27:37+02:00">0</sftp>
</host>
[...]
Thank you!
Feedback
orestes.ca@gmail.com

Team
Project Manager Juanra Posada
Lead Developer Orestes Carracedo
Developers Javier Morales
Dimas López

http://www.focusonemotions.com

JavaScript Ninja Raúl Jiménez
System Administrators Javier Domingo

dev@focusonemotions

Gonzalo Rodríguez
Challenge
Break out of the player app, win an
Amazon gift card!
●
●
●
●

Try to guess the unlock gesture
Try to guess the unlock code
No buttons
No fastboot

More Related Content

What's hot

Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
Opersys inc.
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
Utkarsh Mankad
 
Native Containers on Windows 10 using Docker – a game changer for developers
Native Containers on Windows 10 using Docker – a game changer for developersNative Containers on Windows 10 using Docker – a game changer for developers
Native Containers on Windows 10 using Docker – a game changer for developers
Jorge Arteiro
 
How to Make Android's Bootable Recovery Work For You by Drew Suarez
How to Make Android's Bootable Recovery Work For You by Drew SuarezHow to Make Android's Bootable Recovery Work For You by Drew Suarez
How to Make Android's Bootable Recovery Work For You by Drew Suarez
Shakacon
 
HackInTheBox - AMS 2011 , Spying on SpyEye - What Lies Beneath ?
HackInTheBox -  AMS 2011 , Spying on SpyEye - What Lies Beneath ?HackInTheBox -  AMS 2011 , Spying on SpyEye - What Lies Beneath ?
HackInTheBox - AMS 2011 , Spying on SpyEye - What Lies Beneath ?
Aditya K Sood
 

What's hot (20)

Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013Working with the AOSP - Linaro Connect Asia 2013
Working with the AOSP - Linaro Connect Asia 2013
 
drone continuous Integration
drone continuous Integrationdrone continuous Integration
drone continuous Integration
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Log 2012.04.09 07.48.24
Log   2012.04.09 07.48.24Log   2012.04.09 07.48.24
Log 2012.04.09 07.48.24
 
Android booting sequece and setup and debugging
Android booting sequece and setup and debuggingAndroid booting sequece and setup and debugging
Android booting sequece and setup and debugging
 
Drone 1.0 Feature
Drone 1.0 FeatureDrone 1.0 Feature
Drone 1.0 Feature
 
The Future of Firefox and JavaScript
The Future of Firefox and JavaScriptThe Future of Firefox and JavaScript
The Future of Firefox and JavaScript
 
@arzumy Dev Setup #klxrb
@arzumy Dev Setup #klxrb@arzumy Dev Setup #klxrb
@arzumy Dev Setup #klxrb
 
Native Containers on Windows 10 using Docker – a game changer for developers
Native Containers on Windows 10 using Docker – a game changer for developersNative Containers on Windows 10 using Docker – a game changer for developers
Native Containers on Windows 10 using Docker – a game changer for developers
 
Android open source project build system phi innovations - android summit 2015
Android open source project build system   phi innovations - android summit 2015Android open source project build system   phi innovations - android summit 2015
Android open source project build system phi innovations - android summit 2015
 
How to Make Android's Bootable Recovery Work For You by Drew Suarez
How to Make Android's Bootable Recovery Work For You by Drew SuarezHow to Make Android's Bootable Recovery Work For You by Drew Suarez
How to Make Android's Bootable Recovery Work For You by Drew Suarez
 
Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013Android Internals at Linaro Connect Asia 2013
Android Internals at Linaro Connect Asia 2013
 
Android Booting Sequence
Android Booting SequenceAndroid Booting Sequence
Android Booting Sequence
 
Root via XSS
Root via XSSRoot via XSS
Root via XSS
 
Random numbers
Random numbersRandom numbers
Random numbers
 
Selenium&amp;behave introduction
Selenium&amp;behave introductionSelenium&amp;behave introduction
Selenium&amp;behave introduction
 
Red Hat, CentOS, Fedora 2019
Red Hat, CentOS, Fedora 2019Red Hat, CentOS, Fedora 2019
Red Hat, CentOS, Fedora 2019
 
Davide Berardi - Linux hardening and security measures against Memory corruption
Davide Berardi - Linux hardening and security measures against Memory corruptionDavide Berardi - Linux hardening and security measures against Memory corruption
Davide Berardi - Linux hardening and security measures against Memory corruption
 
44CON London 2015 - Is there an EFI monster inside your apple?
44CON London 2015 - Is there an EFI monster inside your apple?44CON London 2015 - Is there an EFI monster inside your apple?
44CON London 2015 - Is there an EFI monster inside your apple?
 
HackInTheBox - AMS 2011 , Spying on SpyEye - What Lies Beneath ?
HackInTheBox -  AMS 2011 , Spying on SpyEye - What Lies Beneath ?HackInTheBox -  AMS 2011 , Spying on SpyEye - What Lies Beneath ?
HackInTheBox - AMS 2011 , Spying on SpyEye - What Lies Beneath ?
 

Similar to Betabeers Android as a Digital Signage platform

Android as a digital signage platform
Android as a digital signage platformAndroid as a digital signage platform
Android as a digital signage platform
BeMyApp
 
DomDisc and the Domino data api
DomDisc and the Domino data apiDomDisc and the Domino data api
DomDisc and the Domino data api
Jens Bruntt
 

Similar to Betabeers Android as a Digital Signage platform (20)

Android as a digital signage platform
Android as a digital signage platformAndroid as a digital signage platform
Android as a digital signage platform
 
Android as a digital signage platform
Android as a digital signage platformAndroid as a digital signage platform
Android as a digital signage platform
 
Android Embedded - Smart Hubs als Schaltzentrale des IoT
Android Embedded - Smart Hubs als Schaltzentrale des IoTAndroid Embedded - Smart Hubs als Schaltzentrale des IoT
Android Embedded - Smart Hubs als Schaltzentrale des IoT
 
Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011Android porting for dummies @droidconin 2011
Android porting for dummies @droidconin 2011
 
DomDisc and the Domino data api
DomDisc and the Domino data apiDomDisc and the Domino data api
DomDisc and the Domino data api
 
DevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChungDevFest 2022 - Cloud Workstation Introduction TaiChung
DevFest 2022 - Cloud Workstation Introduction TaiChung
 
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
Advanced Eclipse Workshop (held at IPC2010 -spring edition-)
 
Developing Cross Platform Applications with Golang
Developing Cross Platform Applications with GolangDeveloping Cross Platform Applications with Golang
Developing Cross Platform Applications with Golang
 
Embedded Android
Embedded AndroidEmbedded Android
Embedded Android
 
The Modern Developer Toolbox
The Modern Developer ToolboxThe Modern Developer Toolbox
The Modern Developer Toolbox
 
C# Production Debugging Made Easy
 C# Production Debugging Made Easy C# Production Debugging Made Easy
C# Production Debugging Made Easy
 
Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at eZ Con...
Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at  eZ Con...Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at  eZ Con...
Debugging Effectively in the Cloud - Felipe Fidelix - Presentation at eZ Con...
 
.Net Debugging Techniques
.Net Debugging Techniques.Net Debugging Techniques
.Net Debugging Techniques
 
.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques.NET Debugging Tips and Techniques
.NET Debugging Tips and Techniques
 
An Introduction To Android
An Introduction To AndroidAn Introduction To Android
An Introduction To Android
 
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
An OpenShift Primer for Developers to get your Code into the Cloud (PTJUG)
 
Porting your favourite cmdline tool to Android
Porting your favourite cmdline tool to AndroidPorting your favourite cmdline tool to Android
Porting your favourite cmdline tool to Android
 
Orchestrated Android-Style System Upgrades for Embedded Linux
Orchestrated Android-Style System Upgrades for Embedded LinuxOrchestrated Android-Style System Upgrades for Embedded Linux
Orchestrated Android-Style System Upgrades for Embedded Linux
 
Orchestrated Android-Style System Upgrades for Embedded Linux
Orchestrated Android-Style System Upgrades for Embedded LinuxOrchestrated Android-Style System Upgrades for Embedded Linux
Orchestrated Android-Style System Upgrades for Embedded Linux
 
Linux Security and How Web Browser Sandboxes Really Work (NDC Oslo 2017)
Linux Security  and How Web Browser Sandboxes Really Work (NDC Oslo 2017)Linux Security  and How Web Browser Sandboxes Really Work (NDC Oslo 2017)
Linux Security and How Web Browser Sandboxes Really Work (NDC Oslo 2017)
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdfThe Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
The Value of Certifying Products for FDO _ Paul at FIDO Alliance.pdf
 
Connecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAKConnecting the Dots in Product Design at KAYAK
Connecting the Dots in Product Design at KAYAK
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptxUnpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
Unpacking Value Delivery - Agile Oxford Meetup - May 2024.pptx
 
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdfHow Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
How Red Hat Uses FDO in Device Lifecycle _ Costin and Vitaliy at Red Hat.pdf
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
TEST BANK For, Information Technology Project Management 9th Edition Kathy Sc...
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
The UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, OcadoThe UX of Automation by AJ King, Senior UX Researcher, Ocado
The UX of Automation by AJ King, Senior UX Researcher, Ocado
 
Powerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara LaskowskaPowerful Start- the Key to Project Success, Barbara Laskowska
Powerful Start- the Key to Project Success, Barbara Laskowska
 
IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024IoT Analytics Company Presentation May 2024
IoT Analytics Company Presentation May 2024
 
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
FDO for Camera, Sensor and Networking Device – Commercial Solutions from VinC...
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová10 Differences between Sales Cloud and CPQ, Blanka Doktorová
10 Differences between Sales Cloud and CPQ, Blanka Doktorová
 

Betabeers Android as a Digital Signage platform

  • 1. Android as a Digital Signage platform Betabeers Barcelona November 2013
  • 2. Hello world The company Clients 20 people Orange Digital Signage El Corte Inglés User Interactivity Endesa Sodexo Projects Spain United Kingdom Germany Netherlands Finland www.focusonemotions.com @focusonemotions Ikea Nespresso Fira Barcelona Ajuntament de Barcelona ESADE The Phone House
  • 3. Hello world Orestes Carracedo 8 years as a developer 4 years as an Android user 3,5 years at Focus On Emotions Software Development Director Certified SCRUM Master PHP 5.3 Zend Certified Engineer Read about me http://blog.orestes.io Follow me @orestesCA
  • 6.
  • 7.
  • 9. Briefing Make it on time Code as less as possible Be robust Make use of existing OS tools Make use of existing apps Be flexible Create multiple decoupled tools that work together
  • 10. System architecture Apache Cordova A D B API Client JavaScript player V P N cron scheduler SuperSU BusyBox HTTP API S S H CLI API
  • 13. Quick ADB recap $ adb devices List of devices attached 4df144cb39376f2f device # Over USB 192.168.1.42:5555 device # Over NET $ adb shell echo “Hello world” Hello world $ adb -d shell ls /mnt/sdcard $ adb -s 192.168.1.42:5555 shell ls /mnt/sdcard Enable ADB over Wi-Fi $ adb shell setprop service.adb.tcp.port 5555 $ adb shell stop adbd && start adbd # or you’ll be locked out $ adb connect 192.168.1.42:5555
  • 14. Quick ADB recap Sending keys $ adb shell input keyevent 3 # home Starting activities $ adb shell am start -n com.focusonemotions.android.player./Wrapper Killing a process $ pm stop com.focusonemotions.android.player Installing apps $ adb install foe-player-v1.1.apk $ adb push foe-player-v1.1.apk /system/app Android Monitor <android-sdk>/tools/monitor http://developer.android.com/reference/android/view/KeyEvent.html
  • 16. Player Cordova Rotates screen Shows WebView Provides OS shell access JavaScript Displays content Reads content index file Listens for gesture Asks for security code Shows config manager
  • 17. Scheduler Power management $ reboot # (duh) Screen state management $ input keyevent 26 # power $ input keyevent 82 # menu Player state management $ killall com.focusonemotions.android.player $ am start -n com.[...].player/.Wrapper http://developer.android.com/reference/android/view/KeyEvent.html
  • 18. Restricted user access ● Kill UI process ● Custom launcher AndroidManifest <category android:name="android.intent.category.HOME" /> /system/build.prop qemu.hw.mainkeys=1 ● Custom ROM http://thebitplague.wordpress.com/2013/04/05/kiosk-mode-on-the-nexus-7/
  • 19. Local configuration manager Content Index file Configuration manager Player configuration file Content player
  • 20. Static IP address $ openvpn --config /mnt/sdcard/focus/openvpn/conn.conf > /mnt/sdcard/focus/openvpn/run.log & $ cat /mnt/sdcard/focus/openvpn/conn.conf | grep resolv resolv-retry infinite https://play.google.com/store/apps/details?id=de.schaeuffelhut.android.openvpn.installer https://play.google.com/store/apps/details?id=de.blinkt.openvpn
  • 21. Remote shell $ adb connect 192.168.1.42:5555 . . $ time adb connect 192.168.1.42:5555 unable to connect to 192.168.1.42:5555 real user sys 1m3.163s 0m0.000s 0m0.020s $ time timeout 9s adb connect 192.168.1.42 real user sys 0m9.003s 0m0.000s 0m0.020s
  • 22. Screen capture $ adb shell screencap /mnt/sdcard/focus/capture.png $ adb pull /mnt/sdcard/focus/capture.png $ ./capture.sh oratab-030-01 Getting screencap from oratab-030-01 ... done.
  • 23. Wi-Fi management $ echo "12345678" | wpa_passphrase "SSID" # reading passphrase from stdin network={ ssid="SSID" #psk="12345678" psk=34b59e6b0182725d42460 [...] } $ wpa_passphrase "SSID" "12345678" # may malfunction $ wpa_passphrase "SSID" # may malfunction # reading passphrase from stdin Android Wi-fi/WPA settings /data/misc/wifi/wpa_supplicant.conf
  • 24. Content management $ adb push /local/folder /remote/folder PHP SFTP Wrapper /mnt/sdcard/focus + openvpn + player $ php load-device-content.php 300 7 + scheduler Loading content … + upload 50 % 20/40 KB 100 % 40/40 KB Done. - content - october_2013 + media
  • 26. Statistics & graphs Whisper database (updates to past data) Carbon aggregation (Use an IP, not a hostname UDP is better than TCP, is off by default) Graphite for rendering $ /opt/graphite/bin/carbon-cache.py start --debug $ echo ‘value.received’ `date +%s` | nc -w 1 127.0.0.1 2003 StatsD/statsite as aggregator/proxy (v8 nodejs vs C) <?php StatsD::increment(‘com.focusonemotions.app.pushing’); http://graphite.readthedocs.org/en/latest/ https://github.com/etsy/statsd/ https://github.com/armon/statsite
  • 28. Platforming 1. 2. 3. 4. 5. Plug device in Enable ADB over USB Launch script Enter ID Done! Check ● ● ● ● PING SFTP SSH ADB
  • 29. Platforming Install SuperSU + settings Install BusyBox Install DropBearSSH Fix SFTP subsystem Install player Install scheduler Install OpenVPN certificates from ID Reboot $ sftp root@192.168.1.42:mnt/sdcard/focus bash: /usr/libexec/sftp-server: No such file or directory $ sftp -s /system/xbin/sftp-server root@192.168.1.42:mnt/sdcard/focus sftp> # quick fix [adb] $ ln -s /system/xbin/sftp-server /usr/libexec/sftp-server http://www.chainfire.eu/projects/52/SuperSU/ https://play.google.com/store/apps/details?id=stericson.busybox https://github.com/yath/android_external_dropbear
  • 31.
  • 32.
  • 33.
  • 35. Testing Quick feedback Acceptance Tests ● CLI API ● Web API Physical testing devices
  • 36. Testing Scenario Outline: Get a list of cities based on the passed parameters Given I have an endpoint "http://api.pushmaster.focusonemotions.com/1.0/city/" And I pass an argument "id" "<id>" And I pass an argument "title" "<title>" When I make a "<method>" request to the endpoint Then I should get a valid response "<response>" Examples: | method | GET | GET | GET | GET | GET | id | title | | | 1 | | | Hobbiton | -1 | | | FOO | | | | | | response city/city-list.json city/city-get-by-id.json city/city-get-by-title.json null.json null.json | | | | | |
  • 39.
  • 41. Monitoring with Nagios $ php check-device-content.php 192.168.1.42 Up-to-date $ php check-device-content.php 192.168.1.42 Out of date http://nagios.sourceforge.net/docs/3_0/quickstart.html
  • 42. Monitoring with Nagios <?xml version="1.0" encoding="UTF-8"?> <nagios_status> <hosts> <host name="dev-001"> <status last_change="2013-10-08T16:27:37+02:00">0</status> <connectivity last_change="2013-10-08T16:27:37+02:00">0</connectivity> <content last_change="2013-10-08T16:27:37+02:00">0</content> <sftp last_change="2013-10-08T16:27:37+02:00">0</sftp> </host> [...]
  • 43. Thank you! Feedback orestes.ca@gmail.com Team Project Manager Juanra Posada Lead Developer Orestes Carracedo Developers Javier Morales Dimas López http://www.focusonemotions.com JavaScript Ninja Raúl Jiménez System Administrators Javier Domingo dev@focusonemotions Gonzalo Rodríguez
  • 44. Challenge Break out of the player app, win an Amazon gift card! ● ● ● ● Try to guess the unlock gesture Try to guess the unlock code No buttons No fastboot