Unread SMS tray notification stays after marking SMS as read - android

I've written an application that handles incoming SMS. Everything works great and also marking the processed SMS works. The only thing that doesn't seem to care is the tray notification. It still sits there in the tray and claims there is an unread message (just like the standard SMS app with its little green "1" does). I checked that the message actually is marked as read using the method used in the smspopup sample application, which seems to have the same problem. If I just say "close" on the received message, the tray icon is not updated. Do I miss something here? Do I have to send something like a notification to the tray that it should check again?

If you are talking about notification bar then application which sent that notification to android system should cancel it by calling notificationmanagers cancel(int id) method.
By making SMS read do not clears this notifications, when you go to that sms application(stock sms app may be) then that will call cancel notification method to clear notification bar.
SMS POPUP like apps can not clear notification bar of other stock SMS app.

Related

Action button is not showing in the notification when the application is in background

While sending the notification and when my application is in the foreground, i am getting the notification with the action buttons in the notification, while when my application is killed or in background the notification is coming but without the action button, i am getting just the title and content body.
I have tried many solution but it does work. Is android have new permission issues are introduced?
Any help and suggestion will be appreciated.Here is the Image
As there's no any code provided I can't say what's the specific issue here, butt keep in mind. In FCM there are 2 types of notifications:
Notification payload
Data payload
When you send a notification from FCM, it is a notification payload. In this case if your app is killed, the notification will go directly to the system tray and will be handled by the OS. The onMessageReceived() won't execute.
If you send the notification from the backend side, it's a data payload. In that case the onMessageReceived() will be executed.
Check more here FCM Message Types

Change default action for a Notification

I have created a app that sends and receives Sms messages and displays some info to the receiver. I want to know if its possible to trigger a class from my app when pressing on New Sms Notification, instead of the default action which is trigger Messaging app. Thanks in advance
No, you cannot change what another app's notifications do, for blindingly obvious security reasons.
You are certainly welcome to display your own Notification, though.
Please take a look at using permissions in your Application to allow you to receive the SMS message (which it sounds like is what your trying to do):
http://developer.android.com/reference/android/Manifest.permission.html#RECEIVE_SMS
If you use this in your application, you can receive the SMS, or even select your app as the default application to receive all SMS messages.
Also, if you would like to send the SMS message as well there is the SEND_SMS:
http://developer.android.com/reference/android/Manifest.permission.html#SEND_SMS
Additionally, once you add this ability you can Create your Notification and provide it to the Notification center the same way hangouts does, you will just have to implement a receiver and send a notification when an SMS is received.

Can we perform an ACTION programmatically on a Notification from Notification Listener Service?

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.

Remove sms notification in status bar

I'm building an sms handling application. I'm trying to remove only the notification icon from status bar, if received sms contains previously defined text such as "ALERT". So if the notification sound is open, sound will play as usual.
I can't use abortBroadcast() , because I want to store sms into the inbox. I don't want to delete it completely.
cancel(int) might work, but I don't know how to get id of notification that is created by native sms application of android.
I already tried cancelAll() since it is not my notification, it doesn't work.
Is there any way to do it? Thanks in advance
PS. Maybe I can use abortBroadcast() to block the notification icon at status bar, and then I can put sms into inbox programmatically, but it doesn't sound like a good practice for a simple task.

How to refresh/notify all sms apps and notification bar?

I write sms messenger and have one problem. When user reads sms from my app and deletes them from my app, other apps and notification bar still show that one or more sms as unread. And when the user try to open sms, for example, from notification, other sms messenger didn't show unread sms beacause it was deleted from base from my app.
Is there any way to refresh sms apps and notification that would not show that sms not read?
Thanks!
I don't think there is a way to do this. Furthermore it shouldn't be you job to care about this, it's the job of the other apps to show always the most current data.
But you can show some advised to the user when he starts your app for the first time. GO SMS for example advises the user to turn off the SMS notification of all other SMS applications on the device. I think the reason for this is similar to your issues.

Categories

Resources