As you probably know, an Activity has a Window instance. Dialogs also have their own dedicated Window. Even Services can have Window: InputMethodService uses a Window to receive touch events and draw a keyboard on top of another Window, and DreamService is used to create screensavers.
To open a new window in which you will draw the chathead, you need the SYSTEM_ALERT_WINDOW permission.
Allows an application to open windows using the type TYPE_SYSTEM_ALERT, shown on top of all other applications. Very few applications should use this permission; these windows are intended for system-level interaction with the user.
This is what your users will see when installing the app:
This feature is nice, but remember that with great power comes great responsibility.
Please take care of your user pixels.
Does this imply that Facebook Chatheads (or any application with SYSTEM_ALERT_WINDOW permission) is able to conduct keylogging and take screenshots at arbitrary time?
Is there a way to display image only in launcher? When some activity is started, the icon should disapear.
I thing there may be two ways:
1. parameter for WindowManager
2. detecting running app
But I wasnt lucky to find the solution…
Your tutorial is missing the point, that you need to register your service in the Android manifest file under the application tab.