aleksey-saenko / MusicRecognizer

An Android application for music recognition that uses AudD and ACRCloud services to perform song identification.
GNU General Public License v3.0
513 stars 14 forks source link

Tap to recognize widget #52

Closed liz-desartiges closed 5 months ago

liz-desartiges commented 7 months ago

I just came accross this app looking for an alternative to shazam widget.

some android flavor allow to have widget on their lockscreen (samsung for exemple), and also a widget on the home screen can be quite useful.

I also own a z flip 5 and it's possible with just a few line of xml to allow your widget to be displayed on the external screen which is my main reason to wanting an alternative to shazam.

But unfortunately I have no experience with either kotlin or android development. I will try to look into it, but I would need some help

aleksey-saenko commented 7 months ago

Hi. Yeah, it would be nice to have a widget. You can certainly try to develop it yourself, and I'm ready to discuss any pull requests. But without a good knowledge of Kotlin and Android, it might be challenging to achieve good results. I've added this feature to the upcoming backlog, and when I have some time, I'll see what can be done.

aleksey-saenko commented 5 months ago

Added in version 1.5.0, which is available on F-Droid. You can check how it works on your device.

liz-desartiges commented 5 months ago

I just checked and I think one properties in the widget xml is wrong, I'm currently rebuilding it with this change

index 02712c7..1bfe5c2 100644
--- a/feature/recognition/src/main/res/xml/recognition_widget_info.xml
+++ b/feature/recognition/src/main/res/xml/recognition_widget_info.xml
@@ -10,4 +10,4 @@
     android:targetCellWidth="4"
     android:targetCellHeight="1"
     android:updatePeriodMillis="0"
-    android:widgetCategory="home_screen" />
\ No newline at end of file
+    android:widgetCategory="keyguard|home_screen" />
\ No newline at end of file
aleksey-saenko commented 5 months ago

When clicked, the widget launches a transparent activity to check permissions and request them if necessary, then launches the service. Most likely, opening the activity will request you to unlock the screen, which may not be the expected behavior. But it's good if you check. My devices don't allow me to add widgets to my lock screen.

liz-desartiges commented 5 months ago

with my change it gets listed as widget compatible with the coverscreen. the authentification thingy is not an issue here because all those widgets ask for id anyway to be used on my phone

aleksey-saenko commented 5 months ago

So you have to unlock the screen to access the widget? What then is the point of such widgets?

liz-desartiges commented 5 months ago

I have a foldable flip phone and on it you have regular android widgets that you can run without opening your phone, which is pretty useful for things like shazam or audile

liz-desartiges commented 5 months ago

like so image

aleksey-saenko commented 5 months ago

But if you tap on widget does it request to unlock the screen? Do all widgets require unlocking or only Shazam and Audile?

liz-desartiges commented 5 months ago

no it doesn't you have to unlock to see the list of widgets, you swipe to the right to get to the widgets and if the phone is locked they ask you to authentificate, so there is no need for a second unlock

aleksey-saenko commented 5 months ago

Ok, sorry for all these questions, I just haven’t dealt with such devices yet) If you want you can create a pull request to add "keyguard". May I consider this feature request closed?

liz-desartiges commented 5 months ago

Sorry didn't had the time to make a mr, been quite busy lately