Android App Development
iOS App Development
Flutter App Development
Cross Platform App Development
Hire on-demand project developers and turn your idea into working reality.
Big thanks to Webkul and his team for helping get Opencart 18.104.22.168 release ready!
Screen Overlay is a feature of the Android operating system that allows the applications to draw some layouts over the other applications. The most seen example of this feature is Facebook Messanger. Whenever you receive a message the chat head appears over any application and the user can easily see that whose message it is and can directly reply to it. The feature is supported by Android 23 and above.
Obviously, when your application starts to draw over other application’s UI then it is really going to interrupt the user while surfing the other application. Your application needs special permission from the user to do so. You must have seen the popup when you started using Facebook Messanger. You can see the screenshot below to the get the idea of the layout that appears when an app requests for permission.
If you also want your application to request this to a user then the below-provided code snippet will help you with that.
After this request, if the user permits your application then you will be able to draw over other apps.
1) First of all, Create a LayoutParams variable to define the overlay type, width, height, flags, etc.
2)Now we need a layout that will be inflated on the device window. Suppose we have a layout test.xml which looks something like.
and get the view that needs to be inflated
3) And now, you need to add this view on the screen using the WindowManager class.
To remove the screen overlay, you need to use the remove function of the same WindowManager class
You can play with the layouts and overlay types to get different results.
That’s all for this blog. Thank you very much. This is Vedesh Kumar signing off.
Your email address will not be published. Required fields are marked*
Save my name email and website in this browser for the next time I comment.
Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.
Enquiry or Requirement
If you have more details or questions, you can reply to the received confirmation email.