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.
Related
Is it possible to invoke an ACTION programatically on a Notification from a NotificationListenerService?
I have written a Notification Listener service that reads out all the incoming notifications and dismisses when done. But I'm not sure if we can perform any ACTIONs on the incoming notifications.
For eg: On a WhatsApp message notification I can read the package name, sender and message details but is there a way to send a reply back to the sender?
Currently Android Wear is doing this so I'm wondering if it is following a generic approach of acting upon a Notification or it has a specific API to WhatsApp service.
When ever a whatsapp notification is received via notification listerner service there is one another notification thats received (hidden) which has a tag value something like this XXXXXXX#s.whatsapp.net (xxxxxxx being the phonenumber), I think this somehow holds the key to sending a reply to this user.
I am working on other app logic, which does not require you to send back replies but I found this interesting but could not get enough time to check it myself.
Yes, you can do it by this function:
sbn.notification.actions[0].actionIntent.send()
Yes, we can perform actions on notifications. Pushbullet app on Android has an ability to reply to WhatsApp, Hangouts, Facebook messenger etc when user enters the message form desktop which means that there is a way. I am still trying to figure out how to do it.
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 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.
Is it possible (i'm sure it is because i've seen other apps do it) to know when the clear notifications button is pressed without having an active notification?
For instance, I need to know if the user has an SMS notification, if he pushes clear I would like to be told. Is there a callback for this?
Is it possible (i'm sure it is because i've seen other apps do it) to know when the clear notifications button is pressed without having an active notification?
No, it is not possible.
I need to know if the user has an SMS notification
No, you do not. For starters, there are a few hundred SMS clients, many of which will use Notifications, so there is no singular "SMS notification". And, as noted, you do not have any means of determining when other applications add or remove Notifications.
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)