Open felipecrs opened 1 year ago
I believe this will require the app to set the notification as a conversation. The app may also need to identify as such and I am not sure we will qualify for that.
https://developer.android.com/develop/ui/views/notifications/conversations
With https://www.home-assistant.io/integrations/conversation/ this may actually make sense!
that conversation has nothing to do with a notification you are trying to create :) Android actually only wants a messaging/calling app which the HA app is not. You can read more about that in the link above, but its not at all related to the HA integration.
I think ongoing notifications are also usually at the top of the panel (think: navigation), which is used by the app when sending a notification with persistent: true
. Which device are you using as you've alreayd included it in your code?
I believe this will require the app to set the notification as a conversation.
Forcing notifications in a conversation template doesn't sound great.
It indeed have nothing to do with my use case, although Doorbell ringing is the same as Doorbell calling, which by itself could well be categorized as a call much like any other calling app like Telegram.
I wonder if the Tuya/Smart Life app is also identified as a calling app, because doorbell do calls through their app too.
My point about the Conversation Hass integration is that someone could indeed use the Android conversation features for notifications to make a real "chat-bot" using the Home Assistant app.
Which device are you using as you've alreayd included it in your code?
Tested with both S20 FE Android 12 (which includes Samsung "optimizations") and a Mi 9 with Pixel Experience Android 12 (which does not include any OEM "optimizations").
I will record an example.
I just noticed that it momentarily displays at the top when it rings.
I think ongoing notifications are also usually at the top of the panel (think: navigation), which is used by the app when sending a notification with
persistent: true
. Which device are you using as you've alreayd included it in your code?
I have some ongoing notifications that are lower in priority than a Ring missed person or even a discord message.
I think maybe we need to allow users to set the category?
For example maybe this category will tell the system to keep it at the top? https://developer.android.com/reference/android/app/Notification#CATEGORY_CALL
although this may still not qualify to be above a conversaton it could help because I dont think google maps navigation uses conversation style notifications?
That sounds great.
Apart from that, something that I noticed is that the notification does not display expanded (i.e. with the buttons showing for quick reaction). I suppose this is a consequence of not being on the top of the notification list though.
Apart from that, something that I noticed is that the notification does not display expanded (i.e. with the buttons showing for quick reaction). I suppose this is a consequence of not being on the top of the notification list though.
this behavior will vary from device to device, typically the first notification will be expanded. I believe some devices has an option to keep it expanded but not all. Default behavior is keep them collapsed, the app has no control over this.
Got it.
one thing I am not certain about is how reliable setting the category will be
May be used by the system for ranking and filtering.
"may be used" tells me there are no guarantees.
https://developer.android.com/reference/android/app/Notification#category
I'd say this deserves a shot! :D
Did some tests using call
and navigation
with and without persistent: true
the notification did not appear above the conversation notifications like discord. With that said I can send a junk string as well and the notification is fine but I wonder what the point is if it doesn't do anything?
I am not sure if we will be able to get into the Conversation area without meeting the requirements and I am not sure we will be able to meet the requirements.
https://developer.android.com/develop/ui/views/notifications/conversations#api-notifications
Have you tried CATEGORY_MISSED_CALL?
To ensure that missed calls are surfaced in the prioritized conversation shade and appear correctly in the conversion widget, format missed call notifications as conversations with a category set to CATEGORY_MISSED_CALL.
yup tried missed_call
as well.
format missed call notifications as conversations
This the part where it was mentioned earlier that we should not do
Right. That's the missing part. I'll dive deeper into the documentation later to understand these requirements.
I don't have a Nest Hello doorbell, but I bet their app displays doorbell notifications on top. 😅
I just hope that's not because they are Google. But since I can't confirm, this worths nothing.
They could indeed get their notification to show up if they meet the requirements, which they probably do.
Heres a break down of the requirements
A notification is considered as a conversation notification if the following is true:
- The notification uses MessagingStyle.
This we do not do today
- (Only if the app targets Android 11 or higher) The notification is associated with a valid long-lived dynamic or cached sharing shortcut. The notification can set this association by calling setShortcutId() or setShortcutInfo(). If the app targets Android 10 or lower, the notification doesn't have to be associated with a shortcut, as discussed in the fallback options section.
this we also do not do and its asking us to link the notification to a shortcut on the device.
- The user hasn't demoted the conversation from the conversation section via notification channel settings, at the time of posting.
out of the apps control
Thank you. That makes it easier to follow.
Checking the documentation I'd say that there is another option which makes much more sense to my use case: CallStyle notifications.
There is even support for some kind of native Answer and Hang-up button which is... great, as I have actions for both. Incoming, Ongoing, my automations has enough data to fill these events as well.
Home Assistant is already a place for real calls by using the hass-sip-card and many people use it already. Not only that, go2rtc provides 2-way audio communication which is probably going to make its way to a Lovelace card as well.
That's to say that, if the companion app could expose the ability of handling CallStyle notifications to Home Assistant, that would be a lot for people to build on. I certainly would build on it. :)
Checking the documentation I'd say that there is another option which makes much more sense to my use case: CallStyle notifications.
I am not sure where you got it from that this will work for a conversation as the requirements explicitly mention which style to use and its only MessagingStyle. I don't even see CallStyle mentioned on the linked page.
Home Assistant is already a place for real calls by using the hass-sip-card and many people use it already. Not only that, go2rtc provides 2-way audio communication which is probably going to make its way to a Lovelace card as well.
Sorry but we should not create features for custom integrations/cards, we could consider this if it were part of HA core
From here (clickable image):
Sorry but we should not create features for custom integrations/cards, we could consider this if it were part of HA core
Giving the ability of creating Call-like notifications does not necessarily mean people has to use custom integrations. The majority of the existing official doorbell integrations (like Nest) provides events for when a doorbell rings. That's enough for people to be able to leverage Call-like notifications, for example.
Is your feature request related to a problem? Please describe.
I'm trying to create a notification like Doorbell is ringing. I'm currently using:
But this causes the notification to be displayed on the middle of my other notifications of other apps like WhatsApp and Telegram.
Describe the solution you'd like
Some way to make the notification be displayed on the top of the list. Maybe some sort of Call flagging can be used for the purpose?
Describe alternatives you've considered, if any
I did not find any.
Additional context
None.