简体   繁体   中英

Notification implementation on Android TV

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:

  1. Can we use Notification Manager.
  2. Proper method to implementation Android TV notification.
  3. Can we set the Notification priority
  4. Possible way to find out whether the user has seen/interacted with notification or not
  5. 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 (eg, 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM