Some Kotlin Problem with solutions Every developer need to know

How to use Android Audio Widget Overlay View


Android Audio Widget Overlay View Example
Android Audio Widget Overlay View Example




You know, guys, we have become a bit obsessed with music recently. Since we wanted to create a companion to our equalizer and add to the collection of Android widgets, the idea to develop a nice and convenient audio widget was born almost immediately.

You must see : Crumbling Android Image Slider

So 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 :

Gradle file

To start, you need to add the following dependency to your project in the build.gradle file:


dependencies {
    compile 'com.cleveroad:audiowidget:0.9.0'
}

Manifest file

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(). -->
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW"/>

<!-- 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. -->
<uses-permission android:name="android.permission.VIBRATE"/>


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.
Source: Android Audio Widget Overlay View

Comments