SlideShare ist ein Scribd-Unternehmen logo
1 von 27
Downloaden Sie, um offline zu lesen
Adding multi-screen support to Android* Applicationsusing the Presentation API 
Xavier Hallade, Developer Evangelist, Intel Corporation 
ph0b.com -@ph0b
2 
Android Multi-Screen support 
Miracast 
ChromecastMirroring 
Micro-HDMI 
MHL/Slimport 
Wireless 
Yes 
Yes 
No 
No 
Charges your device 
No 
No 
No 
Yes 
Requiresexisting WiFi 
No 
Yes 
No 
No 
Directcommunication 
Yes 
Yes (withTDLS) 
Yes 
Yes 
Latency 
Low-Med 
Medium 
None 
None 
Number of Supported devices 
Most Android4.2+ devices 
13, more coming 
? 
? 
Since version 4.2, Android supports the Presentation API that allows developers to manipulate the content displayed on additional screens.
3 
Connecting a screen to your device 
Chromecast Mirroring 
Miracast 
Developer Settings
4 
Clone Mode (Default) 
After establishing the connection, user sees local screen on the remote display 
Resolution sent to remote is the same as local display’s 
No need to do anything to support this mode
5 
Extended Video Mode(Intel®Platform Specific) 
Video mode is activated automatically when user plays a video using Android* Media Player framework (ex: VideoView) 
User sees video content on the remote at the 1080p resolution (or whatever the native resolution of the content is) 
Local video rendering is turned off to save power, but UI stays untouched
6 
Dual Screen Display With Single App 
Remote screen used for content viewing 
Local screen used for control & context info 
Application can target this mode using the Android*Presentation API
7 
Dual Screen Display With Background Service 
User can navigate out of the app and play 1080p video on local screen or use any other application, including receiving a phone call without any disruption to background playback
8 
Connecting a Wireless Display on Android* 
Sony* XperiaZ 
Stock/Intel® 
Samsung* Galaxy S4
9 
Miracast* Concept 
Video Render 
Audio Render 
VideoDecode 
AudioDecode 
De-Packetize 
De-Packetize 
Link Content Protection Decrypt (Optional) 
AV DeMux 
Transport 
LLC 
WI-FiMAC (Direct Link) 
Wi-Fi PHY 
SINK 
VideoEncode 
AudioEncode 
Packetize 
Packetize 
Link Content Protection Encrypt (Optional) 
AV Mux 
Transport 
LLC 
WI-FiMAC (Direct Link) 
Wi-Fi PHY 
Video Frames 
Audio Samples 
SOURCE
10 
Adapters 
•Actiontec*ScreenBeamPro 
•Actiontec*ScreenBeamMini 2 
•Netgear*(ex: PTV3000) 
•Viewsonic(WPG-370) 
•Best Buy*Rocketfish* 
•Lenovo* 
•… 
Projectors 
•Dell* 
•Seiko Epson * 
•Ricoh* 
•LG* 
•… 
TVs 
•Samsung* 
•Toshiba* 
•LG* 
•TCL* 
•Sharp* 
•Philips* 
•… 
Miracast*Certified Sink Devices 
Full list of Miracast* certified devices can be found at 
http://www.wi-fi.org/wi-fi-certified-miracast 
Intel®WiDi Certified 
MiBox
11 
Second-Screen Enabled Devices running Android* 4.2.x 
Device 
Miracast* Certified 
HDMI*, MHL* or SlimPort* 
Samsung* Galaxy S4 
Yes 
Yes 
Samsung Galaxy Tab3 10.1 
No 
Yes 
Sony* XperiaZ 
Yes 
Yes 
LG* OptimusG 
Yes 
Yes 
Nexus* 4, 5, 7 (2013) 
Yes 
Yes 
HTC* One 
Yes 
Yes 
… Most Android 4.2+ devices 
Yes
12 
Android* Secondary Display API 
Android added Second-Screen support via the Presentation class in Android* 4.2 (API Level 17), allowing you to: 
Implement support for a second screen in your applications without having to worry about the way the displays are connected (Display agnostic) 
Works with MHL*, HDMI*, SlimPort*, Miracast* & Chromecast Mirroring* compatible devices 
You can control the output on the remote (second) screen independently of the phone screen
13 
The Presentation Object 
Dialog 
Presentation 
You need to have a fragment based navigation if you want to keep it running while navigating in the app. 
The activity should take care of pausing and resuming whatever content is playing within the presentation whenever the activity itself is paused or resumed. 
•Presentation is the based class and should be extended: 
•Presentation inherits from Dialog, and as for a Dialog its lifecycle is bound to an Activity 
public class DemoPresentation extendsPresentation { 
•Needs to be associated with a Display at creation time
14 
Using the Presentation API 
Before showing a Presentation you need to select a Display, this can be done in 2 ways: 
1.MediaRouterAPI (in API 16): system will decide the best display for you! 
also available in the Support Library v7* 
2.Display Manager API (in API 17): Enumeration of displays 
// Get the MediaRouterservice 
MediaRouter mMediaRouter= (MediaRouter)getSystemService(Context.MEDIA_ROUTER_SERVICE); 
// Care only about routes that have full video support. 
MediaRouter.RouteInfomRouteInfo = mMediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO); 
Display presentationDisplay= mRouteInfo.getPresentationDisplay(); 
// Get the DisplayManagerservice. 
DisplayManagermDisplayManager= (DisplayManager)getSystemService(Context.DISPLAY_SERVICE); 
// enumerate the displays 
Display[] presentationDisplays= mDisplayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
15 
Presentation API 
MediaRouter. getSelectedRoute(ROUTE_TYPE_LIVE_VIDEO) 
MediaRouter. routeInfo 
getPresentationDisplay() 
new Presentation(activityContext, display) 
.show() 
Then, using MediaRouter.addCallback, you have to monitor: 
•onRouteUnselected 
•onRouteSelected 
•onRoutePresentationDisplayChanged 
How to get a Presentation displayed: 
And inside the activity owning the Presentation: 
•onResume 
•onPause
16 
Designing Layout for the Presentation 
Use a layout the same way as with a Dialog. 
Display properties are the same than with Google*TV: 
TV display is as bigger from a phone than the user sits further from a phone: screen density is comparable. 
Default theme is HoloDark: light text on dark background is easier to read on TV. 
Orientation is always… landscape! 
TV setting 
Addressable screen size 
Density Identifier 
Screen Density 
Display Resolution 
Screen size identifier 
720p 
1280 x 720 px 
tvdpi 
213 dp 
960 x 540 dp 
large 
1080p 
1920 x 1080 px 
xhdpi 
320 dp 
960 x 540 dp 
large 
source: https://developers.google.com/tv/android/docs/gtv_android_patterns
17 
Second-ScreenDemo
18 
Intel®WiDi –Dual Screen Possibilities 97 MPH 4 POS107 MPH 8 POS111 MPH 14 POSLIVE FEEDTURN 7 
App Window #1 
Configure and add select content 
on 2’ screen 
App Window #2 
View multi-angle 
Videos & more on 
10’ large screen 
Multi-video 
User configured 
Application 
EXTREME 
Content 
Driver #48-Car Cam 
Driver #10 – 
Fol ow the Car 
Track Cam 
Location 
Car Race Main Live Feed 
Driver#8-Car Cam 
Driver#99-Car Cam 
Tweet Feeds…. 
Layout 1 
Layout 4 
Layout 3 
Layout 2 
MPH / POS 
MPH / POS 
MPH //POS 
Clear All 
Follow Driver 
Driver 
Tweets 
Driver Stats 
Live Feed 
Driver 
Location 
Load Layout 
Save Layout 
THERACE 
One application, pulling content from one site, driving two screens!
19 
Ideas for Dual Screen Applications 
Enter search term 
Touchpad Mode 
Web Browser
20 
Ideas for Dual Screen Applications 
And 
Keyboard Input Mode 
w 
q 
e 
r 
t 
y 
u 
i 
o 
p 
s 
a 
d 
f 
g 
h 
j 
k 
l 
z 
 
x 
c 
v 
b 
n 
m 
&123 
/ 
space 
· 
search 
And 
Web Browser
21 
Ideas for Dual Screen Applications 
Games 
Dual Joysticks Mode
22 
Ideas for Dual Screen Applications 
Productivity App
23 
Ideas for Dual Screen Applications 
Current matches 
X vs. Y 
A vs. B 
X vs. Z 
Add Score 
11 
Player X vs. Player Z 
7 
Tournament Manager
25 
Wifi Display APIs -Android* 4.2/4.3 
All of the below APIs are internal as of Android* 4.2/4.3 
They are part of AOSP and publicly exposed, but not part of the framework so are not guaranteed to work 
android.hardware.display.DisplayManager 
… 
String ACTION_WIFI_DISPLAY_STATUS_CHANGED 
WifiDisplayStatusgetWifiDisplayStatus() 
void scanWifiDisplays() 
void connectWifiDisplay(StringdeviceAdress)¹ 
void disconnectWifiDisplay()² 
void forgetWifiDisplay(Stringaddress)² 
void renameWifiDisplay(String address,Stringalias)² 
android.hardware.display. 
WifiDisplayStatus 
intgetFeatureState() 
intgetScanState() 
intgetActiveDisplayState() 
WifiDisplaygetActiveDisplay() 
WifiDisplay[] getAvailableDisplays() 
WifiDisplay[] getRememberedDisplays() 
android.hardware.display.WifiDisplay 
StringgetDeviceAddress() 
String getDeviceName() 
String getDeviceAlias() 
String getFriendlyDisplayName() 
android.provider.Settings 
… 
String ACTION_WIFI_DISPLAY_SETTINGS 
String getDeviceAlias() 
String getFriendlyDisplayName() 
¹android.permission.CONFIGURE_WIFI_DISPLAY required for unknown devices 
²android.permission.CONFIGURE_WIFI_DISPLAY always required
26 
Adding a MediaRouteButton 
In res/menu/default.xml: <item android:title="Media Route Settings" android:actionProviderClass="android.app.MediaRouteActionProvider" android:showAsAction="always" /> //Sets Media Route Button to second screen mode 
mediaRouteActionProvider.setRouteTypes(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
27 
Some last comments 
Presentation from background service: 
•“Draw over apps” permission (SYSTEM_ALERT_WINDOW) 
•TYPE_SYSTEM_ALERTLayoutParam. 
USB Input Back Channel 
HTML5 : 
•standard: http://webscreens.github.io/presentation-api/ 
•Demo implementation in HexGLbuilt with crosswalk: https://github.com/hmin/HexGL 
•documentation: https://github.com/crosswalk-project/crosswalk- website/wiki/presentation-api-manual
Q&A

Weitere ähnliche Inhalte

Was ist angesagt?

Build responsive applications with google flutter
Build responsive applications with  google flutterBuild responsive applications with  google flutter
Build responsive applications with google flutterAhmed Abu Eldahab
 
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)Xavier Hallade
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depthChris Simmonds
 
Android OTA updates
Android OTA updatesAndroid OTA updates
Android OTA updatesGary Bisson
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Opersys inc.
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with PieOpersys inc.
 
Android Security Internals
Android Security InternalsAndroid Security Internals
Android Security InternalsOpersys inc.
 
Build beautiful native apps in record time with flutter
Build beautiful native apps in record time with flutterBuild beautiful native apps in record time with flutter
Build beautiful native apps in record time with flutterRobertLe30
 
Running Android on the Raspberry Pi: Android Pie meets Raspberry Pi
Running Android on the Raspberry Pi: Android Pie meets Raspberry PiRunning Android on the Raspberry Pi: Android Pie meets Raspberry Pi
Running Android on the Raspberry Pi: Android Pie meets Raspberry PiChris Simmonds
 
Flutter overview - advantages & disadvantages for business
Flutter overview - advantages & disadvantages for businessFlutter overview - advantages & disadvantages for business
Flutter overview - advantages & disadvantages for businessBartosz Kosarzycki
 
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.
 
Understaing Android EGL
Understaing Android EGLUnderstaing Android EGL
Understaing Android EGLSuhan Lee
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessNanik Tolaram
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android SecurityMarakana Inc.
 

Was ist angesagt? (20)

Build responsive applications with google flutter
Build responsive applications with  google flutterBuild responsive applications with  google flutter
Build responsive applications with google flutter
 
Android Internals
Android InternalsAndroid Internals
Android Internals
 
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)
 
The Android graphics path, in depth
The Android graphics path, in depthThe Android graphics path, in depth
The Android graphics path, in depth
 
Android OTA updates
Android OTA updatesAndroid OTA updates
Android OTA updates
 
Flutter
FlutterFlutter
Flutter
 
Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?Android Treble: Blessing or Trouble?
Android Treble: Blessing or Trouble?
 
Embedded Android Workshop with Pie
Embedded Android Workshop with PieEmbedded Android Workshop with Pie
Embedded Android Workshop with Pie
 
basics dart.pdf
basics dart.pdfbasics dart.pdf
basics dart.pdf
 
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 Security Internals
Android Security InternalsAndroid Security Internals
Android Security Internals
 
Build beautiful native apps in record time with flutter
Build beautiful native apps in record time with flutterBuild beautiful native apps in record time with flutter
Build beautiful native apps in record time with flutter
 
Running Android on the Raspberry Pi: Android Pie meets Raspberry Pi
Running Android on the Raspberry Pi: Android Pie meets Raspberry PiRunning Android on the Raspberry Pi: Android Pie meets Raspberry Pi
Running Android on the Raspberry Pi: Android Pie meets Raspberry Pi
 
Flutter
FlutterFlutter
Flutter
 
Flutter overview - advantages & disadvantages for business
Flutter overview - advantages & disadvantages for businessFlutter overview - advantages & disadvantages for business
Flutter overview - advantages & disadvantages for business
 
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...
 
Embedded Android : System Development - Part IV
Embedded Android : System Development - Part IVEmbedded Android : System Development - Part IV
Embedded Android : System Development - Part IV
 
Understaing Android EGL
Understaing Android EGLUnderstaing Android EGL
Understaing Android EGL
 
Learning AOSP - Android Booting Process
Learning AOSP - Android Booting ProcessLearning AOSP - Android Booting Process
Learning AOSP - Android Booting Process
 
Deep Dive Into Android Security
Deep Dive Into Android SecurityDeep Dive Into Android Security
Deep Dive Into Android Security
 

Ähnlich wie Using the Presentation API and external screens on Android

Android Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинAndroid Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинGDG Saint Petersburg
 
HTC Developer - 2012
HTC Developer - 2012HTC Developer - 2012
HTC Developer - 2012Bruce Jones
 
Flash platform fitc
Flash platform fitcFlash platform fitc
Flash platform fitcMark Doherty
 
Windows phone 8 overview
Windows phone 8 overviewWindows phone 8 overview
Windows phone 8 overviewcodeblock
 
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 DevicesMotorola Mobility - MOTODEV
 
Android Live Streaming Box Technical
Android Live Streaming Box Technical Android Live Streaming Box Technical
Android Live Streaming Box Technical Jimmin Kurichiyil
 
Droidcon2013 miracast final2
Droidcon2013 miracast final2Droidcon2013 miracast final2
Droidcon2013 miracast final2Droidcon Berlin
 
Embedded Android Real-Time Streaming Optimization
Embedded Android Real-Time Streaming OptimizationEmbedded Android Real-Time Streaming Optimization
Embedded Android Real-Time Streaming OptimizationVIA Embedded
 
Chrysler Smart Screen
Chrysler Smart ScreenChrysler Smart Screen
Chrysler Smart ScreenMostafa Sameh
 
Hybrid App Development with PhoneGap
Hybrid App Development with PhoneGapHybrid App Development with PhoneGap
Hybrid App Development with PhoneGapDotitude
 
Windows Phone 8 Advanced Developers Conference
Windows Phone 8 Advanced Developers ConferenceWindows Phone 8 Advanced Developers Conference
Windows Phone 8 Advanced Developers ConferenceDamir Dobric
 
Adc2012 windows phone 8
Adc2012 windows phone 8Adc2012 windows phone 8
Adc2012 windows phone 8AlexanderGoetz
 
EMEA AppForum 2015 Android KitKat & Lollipop - new features for enterprise de...
EMEA AppForum 2015 Android KitKat & Lollipop - new features for enterprise de...EMEA AppForum 2015 Android KitKat & Lollipop - new features for enterprise de...
EMEA AppForum 2015 Android KitKat & Lollipop - new features for enterprise de...Pietro F. Maggi
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspectiveGunjan Kumar
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment pptsagaroceanic11
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment pptsagaroceanic11
 
Creating Flash Content for Multiple Screens
Creating Flash Content for Multiple ScreensCreating Flash Content for Multiple Screens
Creating Flash Content for Multiple Screenspaultrani
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsPositive Hack Days
 

Ähnlich wie Using the Presentation API and external screens on Android (20)

Android Meetup, Илья Лёвин
Android Meetup, Илья ЛёвинAndroid Meetup, Илья Лёвин
Android Meetup, Илья Лёвин
 
HTC Developer - 2012
HTC Developer - 2012HTC Developer - 2012
HTC Developer - 2012
 
Flash platform fitc
Flash platform fitcFlash platform fitc
Flash platform fitc
 
Windows phone 8 overview
Windows phone 8 overviewWindows phone 8 overview
Windows phone 8 overview
 
Sandeep_Resume
Sandeep_ResumeSandeep_Resume
Sandeep_Resume
 
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
 
Android Live Streaming Box Technical
Android Live Streaming Box Technical Android Live Streaming Box Technical
Android Live Streaming Box Technical
 
Droidcon2013 miracast final2
Droidcon2013 miracast final2Droidcon2013 miracast final2
Droidcon2013 miracast final2
 
Embedded Android Real-Time Streaming Optimization
Embedded Android Real-Time Streaming OptimizationEmbedded Android Real-Time Streaming Optimization
Embedded Android Real-Time Streaming Optimization
 
Chrysler Smart Screen
Chrysler Smart ScreenChrysler Smart Screen
Chrysler Smart Screen
 
Google tv
Google tvGoogle tv
Google tv
 
Hybrid App Development with PhoneGap
Hybrid App Development with PhoneGapHybrid App Development with PhoneGap
Hybrid App Development with PhoneGap
 
Windows Phone 8 Advanced Developers Conference
Windows Phone 8 Advanced Developers ConferenceWindows Phone 8 Advanced Developers Conference
Windows Phone 8 Advanced Developers Conference
 
Adc2012 windows phone 8
Adc2012 windows phone 8Adc2012 windows phone 8
Adc2012 windows phone 8
 
EMEA AppForum 2015 Android KitKat & Lollipop - new features for enterprise de...
EMEA AppForum 2015 Android KitKat & Lollipop - new features for enterprise de...EMEA AppForum 2015 Android KitKat & Lollipop - new features for enterprise de...
EMEA AppForum 2015 Android KitKat & Lollipop - new features for enterprise de...
 
Getting started with android dev and test perspective
Getting started with android   dev and test perspectiveGetting started with android   dev and test perspective
Getting started with android dev and test perspective
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment ppt
 
I phone app develoment ppt
I phone app develoment   pptI phone app develoment   ppt
I phone app develoment ppt
 
Creating Flash Content for Multiple Screens
Creating Flash Content for Multiple ScreensCreating Flash Content for Multiple Screens
Creating Flash Content for Multiple Screens
 
Manish Chasta - Securing Android Applications
Manish Chasta - Securing Android ApplicationsManish Chasta - Securing Android Applications
Manish Chasta - Securing Android Applications
 

Mehr von Xavier Hallade

BCON22: oneAPI backend - Blender Cycles on Intel GPUs
BCON22: oneAPI backend - Blender Cycles on Intel GPUsBCON22: oneAPI backend - Blender Cycles on Intel GPUs
BCON22: oneAPI backend - Blender Cycles on Intel GPUsXavier Hallade
 
Apps development for Recon HUDs
Apps development for Recon HUDsApps development for Recon HUDs
Apps development for Recon HUDsXavier Hallade
 
Etendre ses applications aux smartwatches et TVs android
Etendre ses applications aux smartwatches et TVs androidEtendre ses applications aux smartwatches et TVs android
Etendre ses applications aux smartwatches et TVs androidXavier Hallade
 
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginXavier Hallade
 
Power optimization for Android apps
Power optimization for Android appsPower optimization for Android apps
Power optimization for Android appsXavier Hallade
 
Getting your app on Android TV
Getting your app on Android TVGetting your app on Android TV
Getting your app on Android TVXavier Hallade
 
Android on IA devices and Intel Tools
Android on IA devices and Intel ToolsAndroid on IA devices and Intel Tools
Android on IA devices and Intel ToolsXavier Hallade
 

Mehr von Xavier Hallade (7)

BCON22: oneAPI backend - Blender Cycles on Intel GPUs
BCON22: oneAPI backend - Blender Cycles on Intel GPUsBCON22: oneAPI backend - Blender Cycles on Intel GPUs
BCON22: oneAPI backend - Blender Cycles on Intel GPUs
 
Apps development for Recon HUDs
Apps development for Recon HUDsApps development for Recon HUDs
Apps development for Recon HUDs
 
Etendre ses applications aux smartwatches et TVs android
Etendre ses applications aux smartwatches et TVs androidEtendre ses applications aux smartwatches et TVs android
Etendre ses applications aux smartwatches et TVs android
 
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental pluginMastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
Mastering the NDK with Android Studio 2.0 and the gradle-experimental plugin
 
Power optimization for Android apps
Power optimization for Android appsPower optimization for Android apps
Power optimization for Android apps
 
Getting your app on Android TV
Getting your app on Android TVGetting your app on Android TV
Getting your app on Android TV
 
Android on IA devices and Intel Tools
Android on IA devices and Intel ToolsAndroid on IA devices and Intel Tools
Android on IA devices and Intel Tools
 

Kürzlich hochgeladen

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024SynarionITSolutions
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUK Journal
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 

Kürzlich hochgeladen (20)

Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 

Using the Presentation API and external screens on Android

  • 1. Adding multi-screen support to Android* Applicationsusing the Presentation API Xavier Hallade, Developer Evangelist, Intel Corporation ph0b.com -@ph0b
  • 2. 2 Android Multi-Screen support Miracast ChromecastMirroring Micro-HDMI MHL/Slimport Wireless Yes Yes No No Charges your device No No No Yes Requiresexisting WiFi No Yes No No Directcommunication Yes Yes (withTDLS) Yes Yes Latency Low-Med Medium None None Number of Supported devices Most Android4.2+ devices 13, more coming ? ? Since version 4.2, Android supports the Presentation API that allows developers to manipulate the content displayed on additional screens.
  • 3. 3 Connecting a screen to your device Chromecast Mirroring Miracast Developer Settings
  • 4. 4 Clone Mode (Default) After establishing the connection, user sees local screen on the remote display Resolution sent to remote is the same as local display’s No need to do anything to support this mode
  • 5. 5 Extended Video Mode(Intel®Platform Specific) Video mode is activated automatically when user plays a video using Android* Media Player framework (ex: VideoView) User sees video content on the remote at the 1080p resolution (or whatever the native resolution of the content is) Local video rendering is turned off to save power, but UI stays untouched
  • 6. 6 Dual Screen Display With Single App Remote screen used for content viewing Local screen used for control & context info Application can target this mode using the Android*Presentation API
  • 7. 7 Dual Screen Display With Background Service User can navigate out of the app and play 1080p video on local screen or use any other application, including receiving a phone call without any disruption to background playback
  • 8. 8 Connecting a Wireless Display on Android* Sony* XperiaZ Stock/Intel® Samsung* Galaxy S4
  • 9. 9 Miracast* Concept Video Render Audio Render VideoDecode AudioDecode De-Packetize De-Packetize Link Content Protection Decrypt (Optional) AV DeMux Transport LLC WI-FiMAC (Direct Link) Wi-Fi PHY SINK VideoEncode AudioEncode Packetize Packetize Link Content Protection Encrypt (Optional) AV Mux Transport LLC WI-FiMAC (Direct Link) Wi-Fi PHY Video Frames Audio Samples SOURCE
  • 10. 10 Adapters •Actiontec*ScreenBeamPro •Actiontec*ScreenBeamMini 2 •Netgear*(ex: PTV3000) •Viewsonic(WPG-370) •Best Buy*Rocketfish* •Lenovo* •… Projectors •Dell* •Seiko Epson * •Ricoh* •LG* •… TVs •Samsung* •Toshiba* •LG* •TCL* •Sharp* •Philips* •… Miracast*Certified Sink Devices Full list of Miracast* certified devices can be found at http://www.wi-fi.org/wi-fi-certified-miracast Intel®WiDi Certified MiBox
  • 11. 11 Second-Screen Enabled Devices running Android* 4.2.x Device Miracast* Certified HDMI*, MHL* or SlimPort* Samsung* Galaxy S4 Yes Yes Samsung Galaxy Tab3 10.1 No Yes Sony* XperiaZ Yes Yes LG* OptimusG Yes Yes Nexus* 4, 5, 7 (2013) Yes Yes HTC* One Yes Yes … Most Android 4.2+ devices Yes
  • 12. 12 Android* Secondary Display API Android added Second-Screen support via the Presentation class in Android* 4.2 (API Level 17), allowing you to: Implement support for a second screen in your applications without having to worry about the way the displays are connected (Display agnostic) Works with MHL*, HDMI*, SlimPort*, Miracast* & Chromecast Mirroring* compatible devices You can control the output on the remote (second) screen independently of the phone screen
  • 13. 13 The Presentation Object Dialog Presentation You need to have a fragment based navigation if you want to keep it running while navigating in the app. The activity should take care of pausing and resuming whatever content is playing within the presentation whenever the activity itself is paused or resumed. •Presentation is the based class and should be extended: •Presentation inherits from Dialog, and as for a Dialog its lifecycle is bound to an Activity public class DemoPresentation extendsPresentation { •Needs to be associated with a Display at creation time
  • 14. 14 Using the Presentation API Before showing a Presentation you need to select a Display, this can be done in 2 ways: 1.MediaRouterAPI (in API 16): system will decide the best display for you! also available in the Support Library v7* 2.Display Manager API (in API 17): Enumeration of displays // Get the MediaRouterservice MediaRouter mMediaRouter= (MediaRouter)getSystemService(Context.MEDIA_ROUTER_SERVICE); // Care only about routes that have full video support. MediaRouter.RouteInfomRouteInfo = mMediaRouter.getSelectedRoute(MediaRouter.ROUTE_TYPE_LIVE_VIDEO); Display presentationDisplay= mRouteInfo.getPresentationDisplay(); // Get the DisplayManagerservice. DisplayManagermDisplayManager= (DisplayManager)getSystemService(Context.DISPLAY_SERVICE); // enumerate the displays Display[] presentationDisplays= mDisplayManager.getDisplays(DisplayManager.DISPLAY_CATEGORY_PRESENTATION);
  • 15. 15 Presentation API MediaRouter. getSelectedRoute(ROUTE_TYPE_LIVE_VIDEO) MediaRouter. routeInfo getPresentationDisplay() new Presentation(activityContext, display) .show() Then, using MediaRouter.addCallback, you have to monitor: •onRouteUnselected •onRouteSelected •onRoutePresentationDisplayChanged How to get a Presentation displayed: And inside the activity owning the Presentation: •onResume •onPause
  • 16. 16 Designing Layout for the Presentation Use a layout the same way as with a Dialog. Display properties are the same than with Google*TV: TV display is as bigger from a phone than the user sits further from a phone: screen density is comparable. Default theme is HoloDark: light text on dark background is easier to read on TV. Orientation is always… landscape! TV setting Addressable screen size Density Identifier Screen Density Display Resolution Screen size identifier 720p 1280 x 720 px tvdpi 213 dp 960 x 540 dp large 1080p 1920 x 1080 px xhdpi 320 dp 960 x 540 dp large source: https://developers.google.com/tv/android/docs/gtv_android_patterns
  • 18. 18 Intel®WiDi –Dual Screen Possibilities 97 MPH 4 POS107 MPH 8 POS111 MPH 14 POSLIVE FEEDTURN 7 App Window #1 Configure and add select content on 2’ screen App Window #2 View multi-angle Videos & more on 10’ large screen Multi-video User configured Application EXTREME Content Driver #48-Car Cam Driver #10 – Fol ow the Car Track Cam Location Car Race Main Live Feed Driver#8-Car Cam Driver#99-Car Cam Tweet Feeds…. Layout 1 Layout 4 Layout 3 Layout 2 MPH / POS MPH / POS MPH //POS Clear All Follow Driver Driver Tweets Driver Stats Live Feed Driver Location Load Layout Save Layout THERACE One application, pulling content from one site, driving two screens!
  • 19. 19 Ideas for Dual Screen Applications Enter search term Touchpad Mode Web Browser
  • 20. 20 Ideas for Dual Screen Applications And Keyboard Input Mode w q e r t y u i o p s a d f g h j k l z  x c v b n m &123 / space · search And Web Browser
  • 21. 21 Ideas for Dual Screen Applications Games Dual Joysticks Mode
  • 22. 22 Ideas for Dual Screen Applications Productivity App
  • 23. 23 Ideas for Dual Screen Applications Current matches X vs. Y A vs. B X vs. Z Add Score 11 Player X vs. Player Z 7 Tournament Manager
  • 24. 25 Wifi Display APIs -Android* 4.2/4.3 All of the below APIs are internal as of Android* 4.2/4.3 They are part of AOSP and publicly exposed, but not part of the framework so are not guaranteed to work android.hardware.display.DisplayManager … String ACTION_WIFI_DISPLAY_STATUS_CHANGED WifiDisplayStatusgetWifiDisplayStatus() void scanWifiDisplays() void connectWifiDisplay(StringdeviceAdress)¹ void disconnectWifiDisplay()² void forgetWifiDisplay(Stringaddress)² void renameWifiDisplay(String address,Stringalias)² android.hardware.display. WifiDisplayStatus intgetFeatureState() intgetScanState() intgetActiveDisplayState() WifiDisplaygetActiveDisplay() WifiDisplay[] getAvailableDisplays() WifiDisplay[] getRememberedDisplays() android.hardware.display.WifiDisplay StringgetDeviceAddress() String getDeviceName() String getDeviceAlias() String getFriendlyDisplayName() android.provider.Settings … String ACTION_WIFI_DISPLAY_SETTINGS String getDeviceAlias() String getFriendlyDisplayName() ¹android.permission.CONFIGURE_WIFI_DISPLAY required for unknown devices ²android.permission.CONFIGURE_WIFI_DISPLAY always required
  • 25. 26 Adding a MediaRouteButton In res/menu/default.xml: <item android:title="Media Route Settings" android:actionProviderClass="android.app.MediaRouteActionProvider" android:showAsAction="always" /> //Sets Media Route Button to second screen mode mediaRouteActionProvider.setRouteTypes(MediaRouter.ROUTE_TYPE_LIVE_VIDEO);
  • 26. 27 Some last comments Presentation from background service: •“Draw over apps” permission (SYSTEM_ALERT_WINDOW) •TYPE_SYSTEM_ALERTLayoutParam. USB Input Back Channel HTML5 : •standard: http://webscreens.github.io/presentation-api/ •Demo implementation in HexGLbuilt with crosswalk: https://github.com/hmin/HexGL •documentation: https://github.com/crosswalk-project/crosswalk- website/wiki/presentation-api-manual
  • 27. Q&A