I need to draw a small floating window outside of the app. Something like facebooks floating avatars on top of the screen.
Here is my service:
@RequiresApi(Build.VERSION_CODES.O)
class FloatingWindowService : Service() {
private lateinit var windowManager: WindowManager
override fun onCreate() {
super.onCreate()
windowManager = getSystemService(Context.WINDOW_SERVICE) as WindowManager
val params = WindowManager.LayoutParams(
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.WRAP_CONTENT,
WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE,
PixelFormat.TRANSLUCENT
)
windowManager.addView(/** here shuld be the view controlled by flutter **/, params)
}
}
Any ideas about how to do this?