To create Facebook-Messenger-style chat heads (bubbles) on Android, build a Service that displays a View as an overlay using the SYSTEM_ALERT_WINDOW permission.

 To create Facebook-Messenger-style chat heads (bubbles) on Android, build a Service that displays a View as an overlay using the SYSTEM_ALERT_WINDOW permission. Inside the Service, use WindowManager to float the View on-screen and let users drag it via touch events. On Android 8.0+ you must switch to TYPE_APPLICATION_OVERLAY, and the user has to grant overlay permission manually. Design the bubble’s UI in an XML layout, freely customizing its icon and background. From your Activity, check for overlay permission and start the Service. This simple setup reproduces a Messenger-like UI, though production apps should also link the bubble to notifications and the chat screen. Ensure responsive touch handling and overall UI performance; you can combine this approach with Android’s native bubble-notification API if desired.

TopicOfficial documentation
Requesting and granting SYSTEM_ALERT_WINDOW (overlay) permission, plus changes to ACTION_MANAGE_OVERLAY_PERMISSION from Android 11 onwardAndroid DevelopersAndroid Developers
Constant TYPE_APPLICATION_OVERLAY (window type shown above all apps)Android DevelopersAndroid Developers
Full list of window-type flags and layout params used with WindowManagerAndroid Developers
OS-level bubble notifications used by Messenger and other chat appsAndroid DevelopersAndroid Developers

Comments

Popular posts from this blog

Japan Jazz Anthology Select: Jazz of the SP Era

In practice, the most workable approach is to measure a composite “civility score” built from multiple indicators.