SlideShare a Scribd company logo
1 of 19
Download to read offline
Secondary Screen
Support Using
DisplayManager
Copyright © 2013 CommonsWare, LLC
Who's On Second?
●

Auxiliary screen

●

Inconsistently available

●

Display-only (no touchscreen)

●

Not:
–

Simply being on a TV (think OUYA)

–

Devices with dual primary displays (SONY Tablet
P)
Copyright © 2013 CommonsWare, LLC
Getting To Second: Sending
●

HDMI

●

Mobile High-Definition Link (MHL, SlimPort)

●

Proprietary Cable

●

Miracast/AllShare Cast
–

WifiDirect-based display protocol

–

Available on many modern devices, including most of
the Samsung Galaxy line
Copyright © 2013 CommonsWare, LLC
Getting to Second: Receiving
●

HDMI
–
–

●

Direct
Via MHL adapter

Miracast/AllShare Cast
–

Direct (e.g., most of Samsung Smart TVs)

–

Via HDMI adapter

Copyright © 2013 CommonsWare, LLC
Secondary Display: What Is Shown
●

Android 1.0 through 2.3
–
–

●

Generally nothing
Sporadic device-specific support (e.g., HTC DROID
Incredible and composite output)

Android 3.0 through 4.1
–
–

●

Mirroring
Some limited developer control (video players)

Android 4.2+: Developer Control
–

At least for devices that shipped with 4.2+
Copyright © 2013 CommonsWare, LLC
Not All Screens Are Created Equal
●

Key Differences
–
–

●

Size (720p, 1080p, etc.)
Density (tvdpi, hdpi, etc.)

Net: Different Context for Different Display
–

Inflate layouts, load resources, etc. using proper
Context to get the right ones for the targeted
display
Copyright © 2013 CommonsWare, LLC
Exerting Your Control
●

Presentation
–

Subclass of Dialog, added in API Level 17

–

Override onCreate(), call
setContentView()

–

Supplies Context suitable for use with
designated Display

–

When displayed using show(), appears on
designated Display
Copyright © 2013 CommonsWare, LLC
Exerting Your Control
●

CWAC-Presentation and PresentationHelper
–

Lets you know when a secondary display
becomes available or goes away

–

Usage
●

Create instance

●

Supply a Context and a Listener

●

Forward onPause() / onResume()

●

Implement showPreso() /
clearPreso()
Copyright © 2013 CommonsWare, LLC
Trying It Out
●

Testing Options
–

Actual “secondary screen”

–

Simulated secondary display
●

Developer Options → Simulate secondary displays

●

Works well with hardware, less so with x86 emulator

Copyright © 2013 CommonsWare, LLC
Copyright © 2013 CommonsWare, LLC
Copyright © 2013 CommonsWare, LLC
Low-Level Exertion
●

DisplayManager
–

System service (DISPLAY_SERVICE)

–

getDisplays() (all or those in a category, like
DISPLAY_CATEGORY_PRESENTATION)

–

registerDisplayListener() to find out
about changes in mix of displays

–

New to API Level 17
Copyright © 2013 CommonsWare, LLC
Low-Level Exertion
●

MediaRouter
–

System service (MEDIA_ROUTER_SERVICE)

–

More general: find preferred “route” for audio or
video

–

getSelectedRoute() to find the route to be
used right now (ROUTE_TYPE_LIVE_VIDEO)

–

addCallback() to find out route changes

–

Added in API Level 16
Copyright © 2013 CommonsWare, LLC
Fragments of a Presentation
●

Good News!
–

–

●

Presentation extends Dialog, so
DialogFragment works
DialogFragment supports either
show-as-dialog or show-as-regular-fragment

Bad News!
–

Since different Contexts, cannot use the same
DialogFragment instance for each
Copyright © 2013 CommonsWare, LLC
Secondary Screen Strategies
●

Secondary Screen: Not a Touchscreen
–

●

Whatever shows on secondary screen is driven
and controlled by what is on the primary screen

Example: Video Player
–

Second screen shows the video playback

–

Primary screen has play/pause, fast-forward,
rewind, SeekBar, IMDB content, chat screen, etc.
Copyright © 2013 CommonsWare, LLC
Secondary Screen Strategies
●

Must Have Secondary Screen
–

●

Optional, Dedicated UX
–

●

Presentation-specific app
Game using second screen for primary output,
device screen for control surface and secondary
output

Optional, Using Fragments
–

Push stuff to second screen or show “inline”
Copyright © 2013 CommonsWare, LLC
Secondary Screen Tactics
●

Separate Fragments/Views
–
–

●

One for what is shown
One for controlling what is shown

Mirroring Content
–

Same fragment/view, shown on both displays,
controlled by primary screen

Copyright © 2013 CommonsWare, LLC
Limitations and Annoyances
●

Activity-Based
–

Presentation extends Dialog, must have an
activity to show a Dialog

–

Cannot have second screen driven by service,
with primary screen running something
independent

–

Samsung, multi-window apps, and secondary
screens?
Copyright © 2013 CommonsWare, LLC
Limitations and Annoyances
●

Activity-Based
–

Must dismiss() Presentation as part of
switching to a new activity → flicker
●

Briefly shows mirroring before new Presentation
appears

–

Similar flicker if you try switching from one
Presentation to another

–

General rule: one activity and one
Presentation, just updating content
Copyright © 2013 CommonsWare, LLC

More Related Content

What's hot

Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Opersys inc.
 
Android seminar ppt
Android seminar pptAndroid seminar ppt
Android seminar ppt
chakrapani tripathi
 

What's hot (20)

Q4.11: Porting Android to new Platforms
Q4.11: Porting Android to new PlatformsQ4.11: Porting Android to new Platforms
Q4.11: Porting Android to new Platforms
 
Versions of Android OS
Versions of Android OSVersions of Android OS
Versions of Android OS
 
Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.Industrial Training Report on Java Technology.
Industrial Training Report on Java Technology.
 
Android Development: The Basics
Android Development: The BasicsAndroid Development: The Basics
Android Development: The Basics
 
Embedded Android : System Development - Part III
Embedded Android : System Development - Part IIIEmbedded Android : System Development - Part III
Embedded Android : System Development - Part III
 
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...Using and Customizing the Android Framework / part 4 of Embedded Android Work...
Using and Customizing the Android Framework / part 4 of Embedded Android Work...
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?
 
Building beautiful apps with Google flutter
Building beautiful apps with Google flutterBuilding beautiful apps with Google flutter
Building beautiful apps with Google flutter
 
Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)Embedded Android : System Development - Part II (HAL)
Embedded Android : System Development - Part II (HAL)
 
Mobile development with Flutter
Mobile development with FlutterMobile development with Flutter
Mobile development with Flutter
 
Android Automotive
Android AutomotiveAndroid Automotive
Android Automotive
 
Android seminar ppt
Android seminar pptAndroid seminar ppt
Android seminar ppt
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 
Embedded Android : System Development - Part I
Embedded Android : System Development - Part IEmbedded Android : System Development - Part I
Embedded Android : System Development - Part I
 
Building beautiful apps using google flutter
Building beautiful apps using google flutterBuilding beautiful apps using google flutter
Building beautiful apps using google flutter
 
Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)Embedded Android : System Development - Part III (Audio / Video HAL)
Embedded Android : System Development - Part III (Audio / Video HAL)
 
android media player project proposal
android media player project proposalandroid media player project proposal
android media player project proposal
 
Introduction to Android Development
Introduction to Android DevelopmentIntroduction to Android Development
Introduction to Android Development
 
Android mp3 player
Android mp3 playerAndroid mp3 player
Android mp3 player
 
Android's HIDL: Treble in the HAL
Android's HIDL: Treble in the HALAndroid's HIDL: Treble in the HAL
Android's HIDL: Treble in the HAL
 

Viewers also liked

Viewers also liked (20)

Supporting multiple screens on android
Supporting multiple screens on androidSupporting multiple screens on android
Supporting multiple screens on android
 
Iniciando no desenvolvimento android 2016
Iniciando no desenvolvimento android 2016Iniciando no desenvolvimento android 2016
Iniciando no desenvolvimento android 2016
 
Implementing cast in android
Implementing cast in androidImplementing cast in android
Implementing cast in android
 
Design Multiple Screen android
Design Multiple Screen androidDesign Multiple Screen android
Design Multiple Screen android
 
How to Use OpenGL/ES on Native Activity
How to Use OpenGL/ES on Native ActivityHow to Use OpenGL/ES on Native Activity
How to Use OpenGL/ES on Native Activity
 
Investigation report on 64 bit support in Android Open Source Project
Investigation report on 64 bit support in Android Open Source ProjectInvestigation report on 64 bit support in Android Open Source Project
Investigation report on 64 bit support in Android Open Source Project
 
Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)Using the Android Native Development Kit (NDK)
Using the Android Native Development Kit (NDK)
 
Logging system of Android
Logging system of AndroidLogging system of Android
Logging system of Android
 
IOMX in Android
IOMX in AndroidIOMX in Android
IOMX in Android
 
Improve Android System Component Performance
Improve Android System Component PerformanceImprove Android System Component Performance
Improve Android System Component Performance
 
64-bit Android
64-bit Android64-bit Android
64-bit Android
 
Screen orientations in android
Screen orientations in androidScreen orientations in android
Screen orientations in android
 
Guide to Open Source Compliance
Guide to Open Source ComplianceGuide to Open Source Compliance
Guide to Open Source Compliance
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depth
 
Android's Multimedia Framework
Android's Multimedia FrameworkAndroid's Multimedia Framework
Android's Multimedia Framework
 
Practical steps to mitigate DDoS attacks
Practical steps to mitigate DDoS attacksPractical steps to mitigate DDoS attacks
Practical steps to mitigate DDoS attacks
 
Android IPC Mechanism
Android IPC MechanismAndroid IPC Mechanism
Android IPC Mechanism
 
Design and Concepts of Android Graphics
Design and Concepts of Android GraphicsDesign and Concepts of Android Graphics
Design and Concepts of Android Graphics
 
Booting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot imagesBooting Android: bootloaders, fastboot and boot images
Booting Android: bootloaders, fastboot and boot images
 
Troubleshooting Wireless LANs with Centralized Controllers
Troubleshooting Wireless LANs with Centralized ControllersTroubleshooting Wireless LANs with Centralized Controllers
Troubleshooting Wireless LANs with Centralized Controllers
 

Similar to Secondary Screen Support Using DisplayManager

Mobile apps on the big screen
Mobile apps on the big screenMobile apps on the big screen
Mobile apps on the big screen
Heinrich Seeger
 
Android Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинAndroid Meetup, Илья Лёвин
Android Meetup, Илья Лёвин
GDG Saint Petersburg
 
Utf 8'en'ibm sametime 9 - voice and video deployment
Utf 8'en'ibm sametime 9 - voice and video deployment Utf 8'en'ibm sametime 9 - voice and video deployment
Utf 8'en'ibm sametime 9 - voice and video deployment
a8us
 
Optimizing your Android App for Mass Market Devices
Optimizing your Android App for Mass Market DevicesOptimizing your Android App for Mass Market Devices
Optimizing your Android App for Mass Market Devices
Motorola Mobility - MOTODEV
 
ANDROID presentation prabal
ANDROID presentation prabalANDROID presentation prabal
ANDROID presentation prabal
Prabal Tyagi
 

Similar to Secondary Screen Support Using DisplayManager (20)

Media Resource Sharing Through the Media Controller API
Media Resource Sharing Through the Media Controller APIMedia Resource Sharing Through the Media Controller API
Media Resource Sharing Through the Media Controller API
 
Media Resource Sharing Through the Media Controller API
Media Resource Sharing Through the Media Controller APIMedia Resource Sharing Through the Media Controller API
Media Resource Sharing Through the Media Controller API
 
Google TV For Fun
Google TV For FunGoogle TV For Fun
Google TV For Fun
 
Android Development: The 20,000-Foot View
Android Development: The 20,000-Foot ViewAndroid Development: The 20,000-Foot View
Android Development: The 20,000-Foot View
 
Mobile apps on the big screen
Mobile apps on the big screenMobile apps on the big screen
Mobile apps on the big screen
 
The future of WebRTC - Sept 2021
The future of WebRTC - Sept 2021The future of WebRTC - Sept 2021
The future of WebRTC - Sept 2021
 
Android Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинAndroid Meetup, Илья Лёвин
Android Meetup, Илья Лёвин
 
Utf 8'en'ibm sametime 9 - voice and video deployment
Utf 8'en'ibm sametime 9 - voice and video deployment Utf 8'en'ibm sametime 9 - voice and video deployment
Utf 8'en'ibm sametime 9 - voice and video deployment
 
CDS Cloud Network Media Player
CDS Cloud Network Media Player CDS Cloud Network Media Player
CDS Cloud Network Media Player
 
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
WebRTC Standards & Implementation Q&A - getDisplayMedia 1.0
 
Multimedia networking
Multimedia networkingMultimedia networking
Multimedia networking
 
Hitting a moving target: achieving mobile inclusion
Hitting a moving target: achieving mobile inclusionHitting a moving target: achieving mobile inclusion
Hitting a moving target: achieving mobile inclusion
 
Optimizing your Android App for Mass Market Devices
Optimizing your Android App for Mass Market DevicesOptimizing your Android App for Mass Market Devices
Optimizing your Android App for Mass Market Devices
 
What's New in Jelly Bean
What's New in Jelly BeanWhat's New in Jelly Bean
What's New in Jelly Bean
 
ANDROID presentation prabal
ANDROID presentation prabalANDROID presentation prabal
ANDROID presentation prabal
 
A Guide to the Top Cross Platform Video Players
A Guide to the Top Cross Platform Video PlayersA Guide to the Top Cross Platform Video Players
A Guide to the Top Cross Platform Video Players
 
Android Live Streaming Box Technical
Android Live Streaming Box Technical Android Live Streaming Box Technical
Android Live Streaming Box Technical
 
Mis Presentation Quest
Mis Presentation  QuestMis Presentation  Quest
Mis Presentation Quest
 
160811_오토테크컨퍼런스_vault micro
160811_오토테크컨퍼런스_vault micro160811_오토테크컨퍼런스_vault micro
160811_오토테크컨퍼런스_vault micro
 
BP503 IBM Connect 2014
BP503 IBM Connect 2014BP503 IBM Connect 2014
BP503 IBM Connect 2014
 

More from CommonsWare

Gradle and Your Android Wearable Projects
Gradle and Your Android Wearable ProjectsGradle and Your Android Wearable Projects
Gradle and Your Android Wearable Projects
CommonsWare
 

More from CommonsWare (20)

Gradle and Your Android Wearable Projects
Gradle and Your Android Wearable ProjectsGradle and Your Android Wearable Projects
Gradle and Your Android Wearable Projects
 
Getting Android Developers for Your Wearables
Getting Android Developers for Your WearablesGetting Android Developers for Your Wearables
Getting Android Developers for Your Wearables
 
When Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable AppsWhen Microwatts Are Precious: Battery Tips for Wearable Apps
When Microwatts Are Precious: Battery Tips for Wearable Apps
 
The Action Bar: Front to Back
The Action Bar: Front to BackThe Action Bar: Front to Back
The Action Bar: Front to Back
 
Android Security: Defending Your Users
Android Security: Defending Your UsersAndroid Security: Defending Your Users
Android Security: Defending Your Users
 
Mastering the Master Detail Pattern
Mastering the Master Detail PatternMastering the Master Detail Pattern
Mastering the Master Detail Pattern
 
Not Quite As Painful Threading
Not Quite As Painful ThreadingNot Quite As Painful Threading
Not Quite As Painful Threading
 
Maps V2... And You!
Maps V2... And You!Maps V2... And You!
Maps V2... And You!
 
A Deep Dive Into ViewPager
A Deep Dive Into ViewPagerA Deep Dive Into ViewPager
A Deep Dive Into ViewPager
 
Integrate Android Apps and Web Apps
Integrate Android Apps and Web AppsIntegrate Android Apps and Web Apps
Integrate Android Apps and Web Apps
 
From Android to the Mobile Web
From Android to the Mobile WebFrom Android to the Mobile Web
From Android to the Mobile Web
 
X Means Y
X Means YX Means Y
X Means Y
 
The Wonderful World of Wearables
The Wonderful World of WearablesThe Wonderful World of Wearables
The Wonderful World of Wearables
 
Securing User Data with SQLCipher
Securing User Data with SQLCipherSecuring User Data with SQLCipher
Securing User Data with SQLCipher
 
Beaming Data to Devices with NFC
Beaming Data to Devices with NFCBeaming Data to Devices with NFC
Beaming Data to Devices with NFC
 
Making Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business ModelsMaking Money at Mobile: 60 Business Models
Making Money at Mobile: 60 Business Models
 
AppsWorld Keynote
AppsWorld KeynoteAppsWorld Keynote
AppsWorld Keynote
 
App Integration (Revised and Updated)
App Integration (Revised and Updated)App Integration (Revised and Updated)
App Integration (Revised and Updated)
 
Rich Text Editing and Beyond
Rich Text Editing and BeyondRich Text Editing and Beyond
Rich Text Editing and Beyond
 
App integration: Strategies and Tactics
App integration: Strategies and TacticsApp integration: Strategies and Tactics
App integration: Strategies and Tactics
 

Recently uploaded

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
TrustArc Webinar - Unified Trust Center for Privacy, Security, Compliance, an...
 
Navigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern EnterpriseNavigating Identity and Access Management in the Modern Enterprise
Navigating Identity and Access Management in the Modern Enterprise
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
ChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps ProductivityChatGPT and Beyond - Elevating DevOps Productivity
ChatGPT and Beyond - Elevating DevOps Productivity
 
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
WSO2 Micro Integrator for Enterprise Integration in a Decentralized, Microser...
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Corporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptxCorporate and higher education May webinar.pptx
Corporate and higher education May webinar.pptx
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)Introduction to Multilingual Retrieval Augmented Generation (RAG)
Introduction to Multilingual Retrieval Augmented Generation (RAG)
 
Decarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational PerformanceDecarbonising Commercial Real Estate: The Role of Operational Performance
Decarbonising Commercial Real Estate: The Role of Operational Performance
 
JohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptxJohnPollard-hybrid-app-RailsConf2024.pptx
JohnPollard-hybrid-app-RailsConf2024.pptx
 
Quantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation ComputingQuantum Leap in Next-Generation Computing
Quantum Leap in Next-Generation Computing
 
Choreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software EngineeringChoreo: Empowering the Future of Enterprise Software Engineering
Choreo: Empowering the Future of Enterprise Software Engineering
 
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
TEST BANK For Principles of Anatomy and Physiology, 16th Edition by Gerard J....
 
How to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cfHow to Check CNIC Information Online with Pakdata cf
How to Check CNIC Information Online with Pakdata cf
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 AmsterdamDEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
DEV meet-up UiPath Document Understanding May 7 2024 Amsterdam
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 

Secondary Screen Support Using DisplayManager

  • 2. Who's On Second? ● Auxiliary screen ● Inconsistently available ● Display-only (no touchscreen) ● Not: – Simply being on a TV (think OUYA) – Devices with dual primary displays (SONY Tablet P) Copyright © 2013 CommonsWare, LLC
  • 3. Getting To Second: Sending ● HDMI ● Mobile High-Definition Link (MHL, SlimPort) ● Proprietary Cable ● Miracast/AllShare Cast – WifiDirect-based display protocol – Available on many modern devices, including most of the Samsung Galaxy line Copyright © 2013 CommonsWare, LLC
  • 4. Getting to Second: Receiving ● HDMI – – ● Direct Via MHL adapter Miracast/AllShare Cast – Direct (e.g., most of Samsung Smart TVs) – Via HDMI adapter Copyright © 2013 CommonsWare, LLC
  • 5. Secondary Display: What Is Shown ● Android 1.0 through 2.3 – – ● Generally nothing Sporadic device-specific support (e.g., HTC DROID Incredible and composite output) Android 3.0 through 4.1 – – ● Mirroring Some limited developer control (video players) Android 4.2+: Developer Control – At least for devices that shipped with 4.2+ Copyright © 2013 CommonsWare, LLC
  • 6. Not All Screens Are Created Equal ● Key Differences – – ● Size (720p, 1080p, etc.) Density (tvdpi, hdpi, etc.) Net: Different Context for Different Display – Inflate layouts, load resources, etc. using proper Context to get the right ones for the targeted display Copyright © 2013 CommonsWare, LLC
  • 7. Exerting Your Control ● Presentation – Subclass of Dialog, added in API Level 17 – Override onCreate(), call setContentView() – Supplies Context suitable for use with designated Display – When displayed using show(), appears on designated Display Copyright © 2013 CommonsWare, LLC
  • 8. Exerting Your Control ● CWAC-Presentation and PresentationHelper – Lets you know when a secondary display becomes available or goes away – Usage ● Create instance ● Supply a Context and a Listener ● Forward onPause() / onResume() ● Implement showPreso() / clearPreso() Copyright © 2013 CommonsWare, LLC
  • 9. Trying It Out ● Testing Options – Actual “secondary screen” – Simulated secondary display ● Developer Options → Simulate secondary displays ● Works well with hardware, less so with x86 emulator Copyright © 2013 CommonsWare, LLC
  • 10. Copyright © 2013 CommonsWare, LLC
  • 11. Copyright © 2013 CommonsWare, LLC
  • 12. Low-Level Exertion ● DisplayManager – System service (DISPLAY_SERVICE) – getDisplays() (all or those in a category, like DISPLAY_CATEGORY_PRESENTATION) – registerDisplayListener() to find out about changes in mix of displays – New to API Level 17 Copyright © 2013 CommonsWare, LLC
  • 13. Low-Level Exertion ● MediaRouter – System service (MEDIA_ROUTER_SERVICE) – More general: find preferred “route” for audio or video – getSelectedRoute() to find the route to be used right now (ROUTE_TYPE_LIVE_VIDEO) – addCallback() to find out route changes – Added in API Level 16 Copyright © 2013 CommonsWare, LLC
  • 14. Fragments of a Presentation ● Good News! – – ● Presentation extends Dialog, so DialogFragment works DialogFragment supports either show-as-dialog or show-as-regular-fragment Bad News! – Since different Contexts, cannot use the same DialogFragment instance for each Copyright © 2013 CommonsWare, LLC
  • 15. Secondary Screen Strategies ● Secondary Screen: Not a Touchscreen – ● Whatever shows on secondary screen is driven and controlled by what is on the primary screen Example: Video Player – Second screen shows the video playback – Primary screen has play/pause, fast-forward, rewind, SeekBar, IMDB content, chat screen, etc. Copyright © 2013 CommonsWare, LLC
  • 16. Secondary Screen Strategies ● Must Have Secondary Screen – ● Optional, Dedicated UX – ● Presentation-specific app Game using second screen for primary output, device screen for control surface and secondary output Optional, Using Fragments – Push stuff to second screen or show “inline” Copyright © 2013 CommonsWare, LLC
  • 17. Secondary Screen Tactics ● Separate Fragments/Views – – ● One for what is shown One for controlling what is shown Mirroring Content – Same fragment/view, shown on both displays, controlled by primary screen Copyright © 2013 CommonsWare, LLC
  • 18. Limitations and Annoyances ● Activity-Based – Presentation extends Dialog, must have an activity to show a Dialog – Cannot have second screen driven by service, with primary screen running something independent – Samsung, multi-window apps, and secondary screens? Copyright © 2013 CommonsWare, LLC
  • 19. Limitations and Annoyances ● Activity-Based – Must dismiss() Presentation as part of switching to a new activity → flicker ● Briefly shows mirroring before new Presentation appears – Similar flicker if you try switching from one Presentation to another – General rule: one activity and one Presentation, just updating content Copyright © 2013 CommonsWare, LLC