Tuesday, July 23, 2024

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

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. Not do customers must broadcast their complete display screen whereas display screen sharing or casting, guaranteeing they share precisely what they wish to share.

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

What’s app display screen sharing?

Previous to Android 14, customers may solely share or file their complete display screen on Android units, which may expose personal 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 danger of oversharing personal 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 in addition permits new use instances on massive screens. Customers can enhance multitasking productiveness – akin to display screen sharing whereas attending a gathering – by making the most of additional display screen house on these bigger units.

How does it work?

There are three completely different entry factors for customers to start out 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 through the MediaProjection API

Let’s contemplate an instance the place a number consumer needs to share a single app to the individuals of a video name.

The host consumer begins display screen sharing as typical, however now in Android 14 they’re offered 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 complete 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 individuals can see solely the content material from the chosen app.

The host consumer can finish the display screen seize in a couple 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

Methods to assist app display screen sharing?

Apps that use the MediaProjection APIs are able to beginning app display screen sharing with none code modifications. Nevertheless, it’s necessary to check your app to make sure that the display screen sharing expertise works as supposed, because the consumer circulation modifications with this new conduct. Beforehand, the consumer would keep within the host app after the permission dialog. With app display screen sharing the consumer will not 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 centered 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 modifications. The tactic arguments present the correct sizing for the streamed seize.

Observe: 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 unique side 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.

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

The callback is triggered when:

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

Purposes can reap the benefits of this callback by displaying or hiding the captured content material from the output Floor primarily based on whether or not the captured area is presently seen to the consumer. You need to pause or resume the sharing accordingly in an effort to preserve assets.

How Google Meet is enhancing assembly productiveness

“App display screen sharing permits customers to share particular data in a Meet name with out oversharing personal 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 associates, households, coworkers, and different assembly individuals.” – 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 centered and safe app experiences throughout the Android ecosystem.

This new characteristic enhances a number of use instances:

    • Collaboration apps can facilitate centered 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 reasonably than your complete display screen.
    • Instructional apps can show performance with out compromising scholar privateness, and college students can share tasks with out worry of displaying delicate data.

By thoughtfully implementing app display screen sharing, you’ll be able to set up your app as a champion of consumer privateness and comfort.

Related Articles


Please enter your comment!
Please enter your name here

Latest Articles