Create Android Audio Widget Overlay View
If you have already developed a music player and you feel that you want to make it even better, then you’re welcome to use this library and enjoy the results. Let firstly show you the demo :
Now let’s find out what’s behind these juicy audio widget overlay view.
To start, you need to add the following dependency to your project in the build.gradle file:
Hey TMH geekers, One of the privileges Android provides is the possibility to create customizations on various…www.tellmehow.co
As always, to make sure that no user’s data or any other application on a device would be impacted, we need to add two permissions to the app manifest:
<!-- used for drawing widget. This permission must be granted before calling AudioWidget.show(). -->
<!-- used for notifing user that he is about to remove widget when he drags it on remove widget icon. -->
<!-- This permission granted by default on Android 6.0+ devices. -->
Almost every single app needs to show some collection of elements on the screen. In Android, the most efficient way to…www.tellmehow.co
As you can see, the first one will help you draw a widget over other applications. The second one is needed to inform a user that he is about to make a widget disappear when dragging it to the remove icon at the bottom of the screen. Although, the latter is optional.
The next is to create a new instance of your future widget by using the Builder:
AudioWidget audioWidget = new AudioWidget.Builder(context)
Kotlin allows you to define functions and properties at the top level of your files. That's a great feature, but it can…www.tellmehow.co
Or you can use default configuration. Just call:
AudioWidget audioWidget = new AudioWidget.Builder(context).build();