Knowing when the Clear button is pressed - android

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.

Related

Mute a specific notification

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.

Are there things like an Android trigger

I have never developed something in Android before, but now my company has put me on a project which includes android.
My question is this: Is it possible to write an application that runs in the background and waits for triggers (if that is the correct word for it). For instance lets say I want my application to do something as soon as you open your emails or as soon as you get an email. Is there some API that I can use to interact with other applications such as Mail. The application does not have to have any GUI, it will literally just push some information notifications on the mail just received or opened.
I don't require a to technical answer, but rather just yes or no, and indeed yes, where can I get more info on it. Also if it is not possible, is there some workaround to achieve this. I have googled it, but most of the links are how to send an email from your application.
Thanks
EDIT: So it can even be triggered when a notification is received. Then I just want to look at the notification and determine if it is an email?
You could register BroadCastReceiver for the actions that you need to be caught

Prevent WhatsApp from playing notification sound

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.

Possible to set indicator icons on Android phones?

I was wondering if there is a way to programatically set the phone's indicator icons, like GPS or upload/download in progress,etc.. ?
You have to use a Notification. Set the icon when initializing Notification class. You can get more details here
http://developer.android.com/guide/topics/ui/notifiers/notifications.html
Yes, Notifications is what you are looking for. If you are notifying the user about something that just happened (for instance, a message arrived), you should use a plain Notification 1. However, if you want to notify the user that a service is running, then you should call startForeground() from your Service 2, and stopForeground() when you are done with the operation.
Some points to keep an eye out for:
Only use notification for things the user cares about. This may seem pretty obvious, but you'll find a surprising number of applications that notify the user of some background maintenance process that they don't really care (or can do anything) about.
Let the user customize what sort of things should trigger a notification. It might be very annoying for the user if the phone is constantly beeping and vibrating.
Every notification should have an appropriate Intent that allows the user to take action on that particular notification, and that Intent should be the one that makes the most sense for that particular event -- for example, when the user taps a "new message" notification, he expects to be let to a screen where he can read the message. Sending the user to your application's home screen in that case will be much less useful.

Intercept intent to open text messaging?

Suppose a user opens up the default messaging application, scrolls through their text message inbox, and then clicks on a specific person to open up the text messages between them. Is it possible to intercept and act upon the intent fired when they click on that person's name?
To clarify, I don't want to stop other applications from receiving the intent. I suppose intercept was a misleading word. I just want to know if there is some way to detect that the text messaging screen is being opened as well as who it is to.
I strongly believe no. Such capability would pose quite a security risk as "developers" with mischievous intentions could secretly have their app intercepting intents all throughout the device. I would suspect you have to create your own messaging app to accommodate what you have in mind.
I think you're putting to much significance on Intents. That is actually just an action internal to the application. Not everything you click in Android results in an Intent being fired and even if it does, not all intents are broadcast to everybody. In this case, what happens is you touch a list and it opens up another activity, likely via startActivity (which does make use of an Intent but not a broadcast). Additionally, it's not possible to "intercept" Intents. You can act on them, sure, but you can't prevent other applications from seeing them if they are broadcast.

Categories

Resources