O
O
Oleg Chinakin2018-10-01 11:40:35
Android
Oleg Chinakin, 2018-10-01 11:40:35

How is Picture in Picture (PIP) mode done in Android Studio for API 21-23?

Mostly out of curiosity, although it would have helped me a lot in some ways.
There are quite a few apps on the market for watching YouTube videos. And not infrequently they have one interesting function - watching videos in a separate small window on top of all other applications, like this:
5bb1d8c9dcfbc775928987.jpeg
In theory, this is called the picture-in-picture mode (PictureInPicture). There is a steak in the Google documentation about it, but the problem is that it only works from API 24 and newer. I have a phone with Android 6 (API 23).
And the question is: how did they do it? The screenshot above is from my phone. I would like to do something similar to myself in an application with API 21+.
And yet, maybe someone knows how all these "floating" things are made?
For example, there are in Musixmatch applications (if anyone has seen it) or in ES Explorer there are floating, so to speak, icons.
If, for example, ES Explorer is running and minimized, and you downloaded some mp3 file, then even if you are in another application or on the main screen, a small "floating" explorer icon pops up at the edge of the screen on top of all applications, click on it and open ES on the main page and says "You have a new audio track"...
How can this be done?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
illuzor, 2018-10-01
@iLLuzor

Two options come to mind: root hacks and accessibility service

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question