I followed this tutorial and got notification on my sony samrtwatch. But now i want to have dynamic number of actions in manu when notification message is opened. Currently we are having 3 actions only. So is it possible? and if not then is there any other alternatives like setting some UI like the tutorial have and clicking on some of the button on that ui i can get notified back in my application.
Currently there isn't a way to have a dynamic number of actions in the menu for Notification API. Three is the max that you can have and you have to set them at compile time. If you need more flexibility your only option is to use the Control API and build your own notification UI yourself.
Related
For implementing notifications on Android TV below points needs clarification
As I have gone through SO and other articles, Android TV doesn't have notification tray,
Hence Notification has to be handled in a custom way. Therefore, please clarify:
Can we use Notification Manager.
Proper method to implementation Android TV notification.
Can we set the Notification priority
Possible way to find out whether the user has seen/interacted with notification or not
Handling list of notification messages by Local Database or any other method.
Any help would be much appreciated.
Notifications on Android TV OS are significantly different than mobile Android. There is an area to display notifications within the launcher, but it is limited to system-level notifications that are important for the user (e.g., issues with your account or info about OS updates). General app notifications do not show up, which means you need to display any kind of notification within your own app UI and not with the regular NotificationManager and related APIs.
Can we use Notification Manager. / Can we set the Notification priority
Yes, but it won't result in a notification being visible to the user and shouldn't be done on Android TV OS.
Proper method to implementation Android TV notification.
This should be handled within app UI. Most apps have a reserved space to show these on the main screen so that users see them as soon as they open the app.
Possible way to find out whether the user has seen/interacted with notification or not
Since you'll have to display it in your own UI, you can use regular View methods. For example, if you want to know if the user clicked the message, you can add that code to the OnClickListener.
Handling list of notification messages by Local Database or any other method.
This is a bit vague to give a specific answer, so you may want to post a separate question with more details about what you're trying to accomplish. One general way to go about it is that you have a server endpoint that understands the state of notifications for a given user and you sync that with your local database (easiest is probably Sqlite using Room). Your UI needs to be told if there's a relevant notification to display within the app, but the details of that depend on your app architecture.
I want to create interactive notifications for my android app like the ones in iOS: https://news.dueapp.com/ios-10-notifications-one-step-forward-one-step-back-fe712469184e. I know that android launched the interactive notification feature from Jellybean(4.1)
My question is: how many actions can I define in an interactive notifications?
Thanks in advance.
Check out Android notification not showing more than 3 actions and https://developer.android.com/reference/android/app/Notification.Builder.html
You cannot add more than 3 actions, if you want to do something like iOS, you will have to do your own notification layout, or you can also add 1 action that opens a dialog with options.
My intention is to display a notification with a personalised icon. However, if a notification with the same id is already displayed and then I need to add a new notification with the same id, my program will instead prepare a "stacked" version of the notification where the icon is changed to some generic icon and the notification content shows excerpts from the last and current notifications. Similar to how Gmail does when there are multiple emails.
To implement that I need to check if there are notifications of my app, currently displayed. I do not see any API to retrieve my own notifications.
I cannot simply cache the notification details that I have displayed till now, since in that case I need to know when they will be dismissed by the user, and update my cache accordingly. I also do not see any API to listen for dismiss events.
If you observe the gmail app notification behaviour properly u will notice that even when u dismiss one notification gmail shows you the same notification again in the list when a new notification comes. It looks to me that gmail is relying on total unread/unopened messages rather than keeping a cache of notifications.
There is no direct api for ur suggested SDK version. You need to fallback to ur own implementation. However, there is a way to know if a already showed notification was dismissed - How to know when my notification is cleared via Clear button?
This is possible with android 4.3 upwards now
See http://developer.android.com/reference/android/service/notification/NotificationListenerService.html#getActiveNotifications()
My app issues multiple notifications that all may have Jelly Bean style actions [1].
It seems that when I issue multiple notifications, only the last one will have action buttons and I cannot figure out why.
I use a custom intent action for the pendingIntents of every notification and action.
Does anybody know how to create two notifications at the same time that both have action buttons visible?
[1] http://developer.android.com/reference/android/app/Notification.Builder.html#addAction(int,%20java.lang.CharSequence,%20android.app.PendingIntent)
Per the Notification's documentation,
A notification's big view appears only when the notification is expanded, which happens when the notification is at the top of the notification drawer, or when the user expands the notification with a gesture
If you have multiple notifications, be sure to expand the lower ones using one of the gestures as explained on the design page for notifications - I expect that they do have the action controls but are just not expanded.
This is an interesting question. Is there a reason you need more than one notification with an action button? Although action buttons are a nice way of connecting "instantly" with an app, they're primarily for use with something that's running even though you want the UI to be minimal. The best example of this is a media player: you don't want to shut it down, but you don't want to force users to go to the app to control play/pause.
I am creating a chat client on the Android phone, and when someone messages in through another client the application currently switches over to messenger mode. When someone message in through another client I would like the application to indicate the number of messages and indicate a number to display number of incoming messages. I have seen this UI mechanism used in many different apps and would like to implement it. I have looked all through the Android documentation, but cannot find anything.
Can someone please explain how to place the ticker-text / footer indicator onto the application, or what api I should be using?
Normally the applications use 2 methods to notify the user.
The most used is the Notification that display a message on the status bar and if you "open" the status bar it shows the notifications and the user can click on the Notification and open the application.
The other is a Toast, that's a text message that appears on screen, normally on the bottom, that disappears after some time.
I couldn't understand what you want, but these can help you further search for what you want to do.