I've now updated the CWAC-Presentation library.
Two new objects: DisplayManager and DisplayManagerDisplayListener have been added.
These two objects are used (internally) by the PresentationHelper object to detect connection and disconnection of external displays.
So that covers HDMI and MHL cable connected displays and Miracast connected displays too.
First thing i'll say is
i'm disappointed(lols), my dreams of a triple monitor S3 are over..
The S3 supports only
one external display at a time!
With my MHL cable attached i tried to also connect to my Miracast Measy dongle.
A dialog appeared stating:
Unable to start Screen Mirroring.
Disconnect the HDMI cable and try again.
I've created another b4a demo project to demonstrate usage of these new objects and attached it to this post.
Once the demo is started a Service runs listening for DisplayAdded, DisplayChanged and DisplayRemoved events.
An Activity displays a ListView of all currently available displays - and that includes the android device's built in display.
So i've been connecting and disconnecting my MHL cable, and connecting to and disconnecting from my Measy dongle to establish how reliably a change in displays can be detected.
This is easy with the Measy connection but when the MHL cable is connected i am no longer connected via USB so cannot monitor the log output of the Service.
So the Service displays Toast messages when either DisplayAdded or DisplayRemoved events are raised.
On my S3 the events all seem to be raised as expected - though trying to connect both MHL and Measy caused the S3 to reboot one time and another time caused the Measy to display nothing but a green screen.
The raising of events was unpredictable until i again rebooted my S3 and this time didn't try to connect to more than one external display at a time.
The new demo is a way to debug whether your device is correctly detecting changes in connected displays - it should be useful for @
PaulR unless he has fixed his connection problem already.
@
PaulR if you run the demo then run the EZCast app and use the 'cast' mode you'll
not see any events raised when EZCast connects in cast mode to the Measy.
Switch to mirror mode and you should see the DisplayAdded event raised.
This might indicate that EZCast isn't using the standard android API methods to display content on the external display?
The demo could soon be updated to create Presentation objects and display content on external displays. The demo source code shows how to get a Display object from the DisplayManager and a Display object is all you need to initialize a Presentation object.
I'm curious as to whether or not we can create a Presentation in a Service module and then create other Views in the Service module and add them to the Presentation.
Logic says
not - Views and Presentation objects are Activity objects.
But anyone who's played with the Standout library will know that it is
possible to create Views in a Service module.
So i might experiment with that and see what happens.
@
moster67 I could only think that your android SDK files are not up to date.
But you say you have checked that.
Maybe the version of the android.jar configured in the b4a IDE is not recent enough - can you switch to android API 19 android.jar and try again?
Updated CWAC-Presentation library attached to post #1 and DisplayManagerDemo project attached to this post.
(I've also moved the latest ExternalDisplays library files to post #1).
Martin.