【问题标题】:React native notification with custom template for Android使用适用于 Android 的自定义模板响应本机通知
【发布时间】:2016-10-26 20:17:05
【问题描述】:

我一直在尝试寻找一个允许为 Android 自定义通知模板的 react-native 模块。我试过https://github.com/neson/react-native-system-notificationhttps://github.com/zo0r/react-native-push-notification 但似乎它们不允许为android 通知自定义模板- 只设置默认模板值。我正在尝试实现类似的目标:

【问题讨论】:

  • 这个问题你解决了吗?

标签: android push-notification react-native


【解决方案1】:

您可以使用react-native-music-control library 来移动通知面板上的音乐控件。

您可以使用以下方法自定义它。阅读documentation了解更多信息。

  MusicControl.setNowPlaying({ 
title: 'Billie Jean',
artwork: 'https://i.imgur.com/e1cpwdo.png', // URL or RN's image require()
artist: 'Michael Jackson',
album: 'Thriller',
genre: 'Post-disco, Rhythm and Blues, Funk, Dance-pop',
duration: 294, // (Seconds)
description: '', // Android Only
color: 0xFFFFFF, // Notification Color - Android Only
date: '1983-01-02T00:00:00Z', // Release Date (RFC 3339) - Android Only
rating: 84, // Android Only (Boolean or Number depending on the type)
notificationIcon: 'my_custom_icon' // Android Only (String), Android Drawable resource name for a custom notification icon
})

【讨论】:

    【解决方案2】:

    您也可以试试这个react-native-track-player 软件包,它将帮助您显示手机被锁定的控制事件。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-03-06
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-07-01
      • 2021-04-05
      • 1970-01-01
      相关资源
      最近更新 更多