0

I wanted to build a text message application in which If A user is sending a message B user should receive with a sound, how can I add that sound in my code?

  • Is your app the sender or receiver? If the receiver, its easy to play a sound when you get a text, do a simple google search for sending a sound. If you're the sender, there's no way to force the receiver's phone to play a sound when its received if they don't have their phone set up to do so. – Gabe Sechan Nov 04 '18 at 07:52
  • Unless instead of a texting app you meant you're writing a chat app, and both people will have the app. – Gabe Sechan Nov 04 '18 at 07:53
  • @GabeSechan yes, you got me here I am doing the same. Do you mean Android notification sound I have been searching from long all the time getting searches for notification sound. – Himani Sharma Nov 04 '18 at 08:26

1 Answers1

0

For playing a sound when the user received the message, you can use notification channel

Because app should give control to a user they want to receive sound when incoming message received or not.

Notification channel gives more control to a user about a notification.

Like WhatsApp, it gives control to the user then want to receive the sound or mute

Jarvis
  • 1,714
  • 2
  • 20
  • 35
  • Notification channel features is showing only in Android 8.0. I am using Android 3.2.1 do we have any solution for that? – Himani Sharma Nov 04 '18 at 11:49
  • Notification builder has property for set sound, you can check device SDK version use that property – Jarvis Nov 04 '18 at 14:56
  • for more details for notification you can also check below link https://stackoverflow.com/questions/15809399/android-notification-sound – Jarvis Nov 04 '18 at 14:57