Is it really not possible to let my local notification sound ring when the phone is locked?
I want my local notification give sound even if my phone is locked!
another question i searched alot why my local notification doesn't appear on the lock screen?
If you added the sound permission when requesting then it should have the sound when it comes , even when the screen is locked/Sound Muted it will appear , and here is a tutorial that you can give a try
Related
I am working on app and there I need to play sound when there is FCM notification.
I know I can play custom sound and I can play system sound(iOS). see below for code to play system sound
AudioServicesPlaySystemSound(1003);
I have seen this link and this link but nothing is what I want.
What I want:
I want that When the fcm notification come, I want to play the message/Notification sound that has been selected by user as default notification/message sounds. Also if the device is on silent it should not ring in this condition
NOTE: I know we can send sound name in FCM payload and add similar sound file in bundle But I really want to play sound that has been selected by user.
Please help me. I am right now helpless to play that sound.
I want to set a music which is longer than 30sec as notification soound. But after searching about this I came to know that it is not possible to add these type of music as notification sound. notification sound must be in 30sec longer otherwise it will not play music. Now how can I add more than 30sec longer music as notification sound?
I had a similar issue for my alarm app as well. What I did was a workaround when your app is in background. You play a music file in your code in background and increase the volume of the device to maximum. You can play as much longer music file as you want. Stop playing the music when someone clicks on the notification.
The only problem with this is that your app should not be killed or terminated.
I know the ways for,
1.how to stop playing sound and stop vibrating(simultaneously) while push notification comes from server to iPhone device
2.Only playing vibrate with no sound.
but I did not find any way to "play only sound and stop vibrating when new push notification comes" on device.
Long answer: when the phone is set on vibrate, it is not possible to set it so that it will play a sound. The other way around is possible - vibrating without sound, when a push notification is received.
In my application I am using 'UILocalNotification` with a 30 sec audio file. I fire the notification when device is in lock mode. I tried to drag the notification on lock screen, then application will open at that Notification sound is playing, I need to recognize notification sound is playing or not when app is in foreground.
No good way, but you can use NSTimer. Start timer after show notification and make work when timer notify you. It will work, but use it only if any other resolution don't work.
I've been trying to find information on how you can create custom vibrations in iOS.
Vibrations are easy enough when the application is active. But I want to play a custom vibration (like double vibration) together with a local notification when the application is in the background.
The sound framework only seem to give me sound handle ids while the UILocalNotification wants a sound file name.
Any leads?
Implement the vibration on your own with a timer after you posted your local notification. See also UILocalNotification custom soundName only vibrates phone when alertBody is specified (unlike UILocalNotificationDefaultSoundName)?