【问题标题】:Want to implement sticky local notification in React Native for Android想要在 React Native for Android 中实现粘性本地通知
【发布时间】:2018-09-17 18:01:23
【问题描述】:

有没有办法让应用程序的通知保持在锁定屏幕上,并且无论应用程序的状态如何(运行或终止),例如 Weather Channel 应用程序,通知都会在 Android 中下拉。但在本机反应。

如果可能的话,我还希望有一个带有操作按钮的自定义通知。

【问题讨论】:

    标签: android react-native notifications sticky foreground


    【解决方案1】:

    使用React native push notifications

    如果你想让它变得有粘性并且需要自定义操作,你可以像下面这样设置

    PushNotification.localNotification({
        ongoing:true,
        actions: '["Yes", "No"]'
    })
    

    检查Custom action handling 以处理您的自定义操作

    【讨论】:

    • 这仅适用于 Android。有什么方法可以在 iOS 上实现同样的效果吗?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多