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

...
Hello world
Orestes Carracedo
8 years as a developer
4 years as an Android user
3,5 years at Focus On Emotions
Software De...
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 f...
System architecture
Apache Cordova

A
D
B

API Client

JavaScript player
V
P
N

cron

scheduler

SuperSU
BusyBox

HTTP 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 ...
Quick ADB recap
Sending keys
$ adb shell input keyevent 3 # home
Starting activities
$ adb shell am start -n com.focusonem...
Features
Player
Cordova
Rotates screen
Shows WebView
Provides OS shell access

JavaScript
Displays content
Reads content index file...
Scheduler
Power management
$ reboot # (duh)
Screen state management
$ input keyevent 26 # power
$ input keyevent 82 # menu...
Restricted user access
●

Kill UI process
● Custom launcher
AndroidManifest
<category android:name="android.intent.categor...
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...
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:5...
Screen capture
$ adb shell screencap /mnt/sdcard/focus/capture.png
$ adb pull /mnt/sdcard/focus/capture.png
$ ./capture.sh...
Wi-Fi management
$ echo "12345678" | wpa_passphrase "SSID"
# reading passphrase from stdin
network={
ssid="SSID"
#psk="123...
Content management
$ adb push /local/folder /remote/folder

PHP SFTP Wrapper

/mnt/sdcard/focus
+ openvpn
+ player

$ php ...
Statistics & graphs
Statistics & graphs
Whisper database (updates to past data)
Carbon aggregation (Use an IP, not a hostname UDP is better th...
Platforming
Platforming
1.
2.
3.
4.
5.

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

Check
●
●
●
●

PING
SFTP
SSH
...
Platforming
Install SuperSU + settings
Install BusyBox
Install DropBearSSH
Fix SFTP subsystem
Install player
Install sched...
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.pushmas...
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
...
Monitoring with Nagios
<?xml version="1.0" encoding="UTF-8"?>
<nagios_status>
<hosts>
<host name="dev-001">
<status last_c...
Thank you!
Feedback
orestes.ca@gmail.com

Team
Project Manager Juanra Posada
Lead Developer Orestes Carracedo
Developers J...
Challenge
Break out of the player app, win an
Amazon gift card!
●
●
●
●

Try to guess the unlock gesture
Try to guess the ...
Betabeers   Android as a Digital Signage platform
Betabeers   Android as a Digital Signage platform
Betabeers   Android as a Digital Signage platform
Betabeers   Android as a Digital Signage platform
Betabeers   Android as a Digital Signage platform
Betabeers   Android as a Digital Signage platform
Upcoming SlideShare
Loading in …5
×

Betabeers Android as a Digital Signage platform

763
-1

Published on

Slids from my talk at Betabeers Barcelona on November of 2013

Published in: Technology, Business
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total Views
763
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
7
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Betabeers Android as a Digital Signage platform

  1. 1. Android as a Digital Signage platform Betabeers Barcelona November 2013
  2. 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. 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
  4. 4. What’s Digital Signage?
  5. 5. What’s Digital Signage?
  6. 6. The beginning
  7. 7. 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
  8. 8. 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
  9. 9. Prototype http://vimeo.com/72032877
  10. 10. Let’s do it!
  11. 11. 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
  12. 12. 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
  13. 13. Features
  14. 14. 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
  15. 15. 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
  16. 16. 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/
  17. 17. Local configuration manager Content Index file Configuration manager Player configuration file Content player
  18. 18. 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
  19. 19. 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
  20. 20. 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.
  21. 21. 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
  22. 22. 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
  23. 23. Statistics & graphs
  24. 24. 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
  25. 25. Platforming
  26. 26. Platforming 1. 2. 3. 4. 5. Plug device in Enable ADB over USB Launch script Enter ID Done! Check ● ● ● ● PING SFTP SSH ADB
  27. 27. 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
  28. 28. Content Management System
  29. 29. Testing
  30. 30. Testing Quick feedback Acceptance Tests ● CLI API ● Web API Physical testing devices
  31. 31. 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 | | | | | |
  32. 32. All done
  33. 33. Ha ha!
  34. 34. Monitoring with Nagios
  35. 35. 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
  36. 36. 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> [...]
  37. 37. 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
  38. 38. 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
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×