Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to cancel the playing alarm sound? #2

Closed
kingctan opened this issue Aug 26, 2017 · 12 comments
Closed

how to cancel the playing alarm sound? #2

kingctan opened this issue Aug 26, 2017 · 12 comments

Comments

@kingctan
Copy link

how to cancel the playing alarm sound?
can you please add one api to this feature?

Thanks.

@emekalites
Copy link
Owner

will work on that, thanks

@emekalites
Copy link
Owner

done in v1.1.0

@haifahrul
Copy link

haifahrul commented Feb 24, 2019

@emekalites it's not working in Android 7.1.1 also Android above 7.1.1
I'm tested with step :

  1. Set Schedule
  2. Close or Kill the App
  3. When notif is fired, I dismiss the notif, but the sound still not stop

@emekalites emekalites reopened this Feb 25, 2019
@bsdunx
Copy link

bsdunx commented Mar 25, 2019

This does not seem to be working for me on 7.1 or 8.0, perhaps not on any version.

Calling ReactNativeAN.stopAlarm() and then ReactNativeAN.deleteAlarm(...) in the appropriate event handler seems to work correctly.

@haifahrul
Copy link

@bsdunx Did you have tested on 7.1 or 8.0 ?

@bsdunx
Copy link

bsdunx commented Mar 28, 2019

7.1 via emulator and 8.1 on actual device.

@akinmac002
Copy link

akinmac002 commented Oct 24, 2019

This problem is solved. But that's not the right way. Edit on /node_modules/react-native-alarm-notification/android/src/main/java/com/emekalites/react/alarm/notification/ANHelper.java add comment mark, line to:

/*   -----> this.
//sound
 if (!bundle.containsKey("play_sound") && bundle.getBoolean("play_sound")) {
                Uri soundUri = getAlarmUri();
                String soundName = bundle.getString("sound_name");
                if (soundName != null) {
                    if (!"default".equalsIgnoreCase(soundName)) {
                        int resId;
                        if (mContext.getResources().getIdentifier(soundName, "raw", mContext.getPackageName()) != 0) {
                            resId = mContext.getResources().getIdentifier(soundName, "raw", mContext.getPackageName());
                        } else {
                            soundName = soundName.substring(0, soundName.lastIndexOf('.'));
                            resId = mContext.getResources().getIdentifier(soundName, "raw", mContext.getPackageName());
                        }

                        soundUri = Uri.parse("android.resource://" + mContext.getPackageName() + "/" + resId);
                    }
                }
                try {
                    ringtone = RingtoneManager.getRingtone(mContext, soundUri);
                    ringtone.play();
                } catch (Exception e){
                    Log.e(TAG, "failed to play ringtone", e);
                }
}
*/   ----> and this.

@stale
Copy link

stale bot commented Apr 3, 2020

Hola! So here's the deal, between open source and my day job and life and what not, I have a lot to manage, so I use a GitHub bot to automate a few things here and there. This particular GitHub bot is going to mark this as stale because it has not had recent activity for a while. It will be closed if no further activity occurs in a few days. Do not take this personally--seriously--this is a completely automated action. If this is a mistake, just make a comment, DM me, send a carrier pidgeon, or a smoke signal.

@stale stale bot added the stale label Apr 3, 2020
@akinmac002
Copy link

The problem still persists. It no longer works in the solution I suggested previously. @emekalites

@emekalites it's not working in Android 7.1.1 also Android above 7.1.1
I'm tested with step :

  1. Set Schedule
  2. Close or Kill the App
  3. When notif is fired, I dismiss the notif, but the sound still not stop

I'm having this problem.

Android 7.1 - Sony Experia Z5 Compact

@ASIF-Mahmud1
Copy link

I am also facing the same issue

@sadia-onyxtec
Copy link

Any solution?

@josedomingos919
Copy link
Contributor

Hello, @emekalites i have the same problem..

Chae-Sumin pushed a commit to Chae-Sumin/react-native-alarm-notification that referenced this issue Nov 9, 2023
…ssed

Stop ringing when dismissed from a quit state in android
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants