Android Auto detect multi-window screen

163 Views Asked by At

How can I detect the transition of an Android Auto Navigation Screen from full-screen mode to a multi-window screen, where the screen is split with a different app, such as music apps, like the following picture?

enter image description here

3

There are 3 best solutions below

1
On

This isn't currently possible for apps built using the Car App Library. Since it looks like your app is a navigation app, you'll still receive callbacks to your SufaceCallback when the size of the surface changes due to Android Auto entering split screen mode. What's your use case?

0
On

If I am not mistaken, when screen is being shared and the size of app UI(the part of screen which your app is being shown in), the system is recreating your app current launching activity with new screen sizes, if that's right you should store your activity UI state in view model and reuse it when the activity is recreated, you can check this via adding logs in acticity lifecycle functions, and see what's being happen when you share screen.

If the first part of the answer is still wrong(which may be cause I just imagine that process in that way, may be I am wrong, I have not tested that), you will figure out what's going on at that moment, and I hope that will help you to move to the next step at least.

0
On

When you go between full screen and split screen either/both VisibileArea and StableArea are updated.

It looks like you are using mapbox's map? If so you can use MapboxCarMapObserver's onVisibleAreaChanged to detect changes and then use the new visibile area to be able to set the correct padding to center your gps marker for example