Sunday, November 24, 2024

Enhanced display screen sharing capabilities in Android 14 (and Google Meet) enhance assembly productiveness


Posted by Francesco Romano – Developer Relations Engineer on Android

App display screen sharing improves privateness and productiveness

Android 14 QPR2 brings thrilling developments in consumer privateness and streamlined multitasking with app display screen sharing. Now not do customers should broadcast their whole display screen whereas display screen sharing or casting, guaranteeing they share precisely what they need to share.

Leverage the brand new MediaProjection APIs to customise the display screen sharing expertise and ship even higher utility to your customers.

What’s app display screen sharing?

Previous to Android 14, customers may solely share or document their whole display screen on Android units, which may expose non-public data in different apps or notifications.

App display screen sharing is a brand new platform characteristic that lets customers prohibit sharing and recording to a single app window, mitigating the chance of oversharing non-public messages or notifications. With app display screen sharing, the standing bar, navigation bar, notifications, and different system UI components are excluded from the shared show. Solely the content material of the chosen app is shared.

This not solely enhances safety for display screen sharing, but additionally allows new use instances on massive screens. Customers can enhance multitasking productiveness – similar to display screen sharing whereas attending a gathering – by profiting from additional display screen house on these bigger units.

How does it work?

There are three completely different entry factors for customers to begin app display screen sharing:

  1. Begin casting from Fast Settings
  2. Begin display screen recording from Fast Settings
  3. Launch from an app with display screen sharing or recording capabilities by way of the MediaProjection API

Let’s contemplate an instance the place a bunch consumer desires to share a single app to the contributors of a video name.

The host consumer begins display screen sharing as ordinary, however now in Android 14 they’re introduced with an up to date dialog that permits them to decide on whether or not to share a single app as a substitute of their whole display screen.

The host consumer decides to share a single app, and so they choose the app from the App Selector.

Throughout display screen sharing, the video name contributors can see solely the content material from the chosen app.

The host consumer can finish the display screen seize in a number of methods: from the app the place sharing began, within the notification shade, by closing the app being shared, or by ending the video name.

visual journey of host sharing a single app to the participants in a video call across four panels

The right way to assist app display screen sharing?

Apps that use the MediaProjection APIs are able to beginning app display screen sharing with none code adjustments. Nevertheless, it’s essential to check your app to make sure that the display screen sharing expertise works as meant, for the reason that consumer circulate adjustments with this new habits. Beforehand, the consumer would keep within the host app after the permission dialog. With app display screen sharing the consumer shouldn’t be returned to the host app, however the goal app to be shared is launched as a substitute. If the goal app was already operating in foreground (e.g. in multi window mode), then it merely turns into the highest targeted app.

Android 14 additionally introduces two callback strategies to empower you to customise the sharing expertise:

MediaProjection.Callback#onCapturedContentResize(width, peak) is invoked instantly after seize begins or when the dimensions of the captured area adjustments. The strategy arguments present the correct sizing for the streamed seize.

Notice: The given width and peak correspond to the identical width and peak that might be returned from android.view.WindowMetrics#getBounds() of the captured area.

If the recorded content material has a distinct facet ratio from both the VirtualDisplay or output Floor, the captured stream has black bars across the recorded content material. The applying can keep away from the black bars across the recorded content material by updating the dimensions of each the VirtualDisplay and output Floor:

override enjoyable onCapturedContentResize(width: Int, peak: Int): String {
    // VirtualDisplay occasion from MediaProjection#createVirtualDisplay().
    virtualDisplay.resize(width, peak, dpi)

    // Create a brand new Floor with the up to date dimension.
    val textureName: Int // the OpenGL texture object identify
    val surfaceTexture = SurfaceTexture(textureName)
    surfaceTexture.setDefaultBufferSize(width, peak)
    val floor = Floor(surfaceTexture)

    // Make sure the VirtualDisplay has the up to date Floor to ship the seize to.
    virtualDisplay.setSurface(floor)
}

The opposite API is MediaProjection.Callback#onCapturedContentVisibilityChanged(isVisible), which is invoked after seize begins or when the visibility of the captured area adjustments. The strategy argument signifies the present visibility of the captured area.

The callback is triggered when:

    • The captured area turns into invisible (isVisible==False).This may increasingly occur when the projected app shouldn’t be topmost anymore, like when one other app completely covers it, or the consumer navigates away from the captured app.
    • The captured area turns into seen once more (isVisible==True).This may increasingly occur if the consumer strikes the protecting app to point out at the least some portion of the captured app (for instance, the consumer has a number of apps seen in multi-window mode).

Functions can reap the benefits of this callback by exhibiting or hiding the captured content material from the output Floor based mostly on whether or not the captured area is presently seen to the consumer. It is best to pause or resume the sharing accordingly with a view to preserve assets.

How Google Meet is enhancing assembly productiveness

“App display screen sharing allows customers to share particular data in a Meet name with out oversharing non-public data on the display screen like messages and notifications. Customers can select particular apps to share, or they can share the entire display screen as earlier than. Moreover, customers can leverage split-screen mode on massive display screen units to share content material whereas nonetheless seeing the faces of pals, households, coworkers, and different assembly contributors.” – Product Supervisor at Google Meet

Let’s see app display screen sharing in motion throughout a video name, on this coming-soon model of Google Meet!

moving image of app screen sharing in action during a video call on Google Meet

Window on the world

App display screen sharing opens doorways (and home windows) for extra targeted and safe app experiences throughout the Android ecosystem.

This new characteristic enhances a number of use instances:

    • Collaboration apps can facilitate targeted dialogue on particular design components, paperwork, or spreadsheets with out together with distracting background particulars.
    • Tech assist brokers can remotely view the consumer’s drawback app with out seeing doubtlessly delicate content material in different areas.
    • Video conferencing instruments can share a presentation window selectively quite than your complete display screen.
    • Instructional apps can exhibit performance with out compromising pupil privateness, and college students can share initiatives with out concern of exhibiting delicate data.

By thoughtfully implementing app display screen sharing, you may set up your app as a champion of consumer privateness and comfort.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles