I have created a broadcast receiver that uses the SMS_RECEIVER. So far everything works fine with it. Now I would like to modify the notification settings for the sms e.g. adjust volume, turn on vibrate, change audio file...
Basically, I would like this app to duplicate the custom ringtone notification. So I would get the sms, check the senders phone number, and change the notification accordingly. I'm having trouble finding documentation on how to do this per text message. Could someone please link me to some documentation or a code snipet of how to do this?
(I found an example on how to silence the phone but the problem with that example is the phone will remain silenced until the code/user turns the volume back on. I would like to only perform the action on the text message being received at the time, this way it will not affect other functionality of the phone)
Related
I am using a Notification Listener Service to receive any posted notification.
For some reason I would like to mute a notification that comes with a specific text. For example, if a Whatsapp notification is posted from a specific contact I may decide to mute that notification or to let it play as normal.
Is there any way to mute it?
I receive many emails from Office and all of them are important and I have to wake up in the night. But sometimes one is not important (the subject in the email is "not urgent") and I don't need to wake up in that case.
I know I can dismiss a notification but I want to let it display. I just want to mute the sound. Any ideas?
I Don't think you can "mute" notification from other apps. Every App works in it's own sandbox so you can't react with an "multi-maintenance-tool" to the apps.
A better Idea is to use an extended e-mail client (like K-9 Email) and check, if there are features like yours in there. Or check other e-mail clients.
I am currently developing a simple sms alarm which plays an alarm whenever a certain number is texting you or when a certain word is showing up in the message.
Now i want to do the same thing, but with notifications.
I want my app to alert me when certain word appears in the notification title or text.
My question is, it is possible to catch all the notifications in a broadcast receiver like i do with the sms?
One possible way, that would not read everything in the notification would be to set up your application as Accessability application that's allowed to listen to (pretty much) everything.
But in 4.3 they have added the NotificationListenerService. Best guideance is probably to look at the docs. There's an another example available: https://github.com/kpbird/NotificationListenerService-Example
maybe you know the problem, you're in a whatsapp group with many notifications about messages you don't care about.
To prevent turning off all notifications/sounds, how can i catch/hook the notifcation event from whatsapp, and maybe even discard a notification in the top bar ?
Thanks for any suggestions
You cannot monitor, control, override and dismiss notifications from another app in your own app.
However, in the WhatsApp specific case, you can mute the group from within the WhatsApp app, or even turn off group notifications entirely.
I would like to write a simple app which can manage the default SMS notification by assigning a specific sound to a specific user. In my intention this app would only do this (so it's not a complete replacement of SMS app) and let the user handle sms with the default SMS App.
So it simply turns into the ability to override programmatically the sms notification sound when one is received. The notification sound are stored on the SD card. I tried couple ways to obtain this but until now no success:
Using RingtoneManager.setActualDefaultRingtoneUri() inserting tone into ContentResolver leads me to some annoying issues. First when added to database, the new ringtone appears in the sound list and second, once the notification is overridden using RingtoneManager.setActualDefaultRingtoneUri(), I'm not able to roll back to the default notification sound and in particular I don't know WHEN doing it!
Creating a Notification object and using PreferenceManager class but facing similar problems as written above (WHERE override the sound and WHEN doing it).
Thank you all in advance.
i have read for hours about how to start play a sound the way i want
but i cannot find an answer.
Here goes,
When device receive a C2DM push im displaying a Notification.
User can click the Notficationand my activity start.
Everything works grate.
Now I would like to create a phone-call-type of ring-sound
so it sounds like there's an incoming Voice call.
User pick up phone and notice my Notification presses it
and the sound stop playing.
Or even better, the C2DM message trigger my activity to start
with a phone-call-type of ring-sound.
When user touch the phone the sound stop playing
any help in any direction would be grate
Set the sound data member of your Notification to a Uri pointing to the ringtone you want to have played when the Notification is displayed. Ideally, you let the user pick their own ringtone (e.g., via a RingtonePreference) rather than forcing a certain ringtone on them.
Or even better, the C2DM message trigger my activity to start with a phone-call-type of ring-sound.
Popping up an activity like this, when the user might be in the middle of something else, is infrequently a good idea.