So , i want to make an app that can i can minimize and move over other apps. I saw this feature on the twitch app and did some research but didn't find how they did it.here is an example of this feature. Thank you for your answers in advance.
-
I believe you should check foreground service and https://stackoverflow.com/questions/4481226/creating-a-system-overlay-window-always-on-top – svkaka Mar 16 '19 at 15:57
-
you can't minimize an app on android. when u want to do something in background, u can use startforegroundservice – Alan Deep Mar 16 '19 at 16:09
-
@svkaka Ty for yours answers , the thread you linked me is interesting. it looks like it's a foreground service, but with this "minimized app " aswell. I added a picture for more clarification – yiligil Mar 16 '19 at 16:40
-
@AlanDeep Ty for your comment, you're right , it's not really a minimized app. I added a picture to explain what i meant – yiligil Mar 16 '19 at 16:43
-
Hi, @yiligil, Twitch app uses foreground service with a floating view and `android.permission.SYSTEM_ALERT_WINDOW`, it's as simple as Messenger floating button! – khalid3e Mar 16 '19 at 17:58
1 Answers
The example you showed is Android's Picture-in-Picture feature: https://developer.android.com/guide/topics/ui/picture-in-picture
However, it's not exactly a minimized app. Picture-In-Picture mode is simply a way for your content to be shown when users switch to other apps.
Due to this, there's a number of restrictions and guidelines, such as you're encouraged to hide all UI elements when in PIP mode besides the content that is displayed.
You're allowed to provide a list of Actions for the user to interact with, such as media controls. But note that there's a limit to how many actions that can be provided.
So it's not exactly a minimized app in the sense that its a smaller version of your app. Instead, it's more like the main viewing content of your app has been plucked out of your app and it's displaying over other apps.
If that's all your app needs, then Picture-In-Picture mode will work well.
But if you want a real mini-version of your app, you're going to have to consider Floating Windows instead. Floating Apps create a UI through a Service instead of an Activity.

- 3,184
- 1
- 11
- 12
-
Thank's a lot for you detailed answer, that was exactly what i was looking for ! – yiligil Mar 18 '19 at 14:51