SimpleMobileTools / Simple-Clock

Combination of a beautiful clock with widget, alarm, stopwatch & timer, no ads
https://www.simplemobiletools.com
GNU General Public License v3.0
588 stars 237 forks source link

#242 Fix for alarm playing twice #466

Closed rawlin closed 1 year ago

rawlin commented 1 year ago

Short Description

The notification triggering the fullScreenIntent also had the same alarm sound causing the issue

Issue

https://github.com/SimpleMobileTools/Simple-Clock/issues/242

tibbi commented 1 year ago

Alarm sound can be customized though, what about that case? I guess this just plays the default one.

rawlin commented 1 year ago

Alarm sound can be customized though, what about that case? I guess this just plays the default one.

The alarm sound is also played in RemiderActivity through MediaPlayer which is started by this notification. So there is no need to set a sound for the notification here

tibbi commented 1 year ago

it always plays the default audio on lockscreen to me, plus it also vibrates, even through the vibrations are disabled at the Edit alarm dialog (that wasnt the purpose of this PR, just saying). It happens on my Samsung with Android 13, try reproducing it with some other device. If the screen is on at triggering the alarm, both the audio and vibrations behave as they should.

rawlin commented 1 year ago

Got the issue! A notification channel once created stays forever, hence the if block in which the audio properties are now removed never executes if the channel already exists.

I've refactored the code and done some cleanup of the previous notification channel.

It should work fine now, irrespective if it is a fresh install or not

tibbi commented 1 year ago

vibrations still misbehave when the screen is on, but there is another task for that, so Ill accept this. Thanks