简体   繁体   English

Flutter:Android:如何制作带有一些操作按钮的不可移动的本地通知工具栏,如屏幕截图所示

[英]Flutter: Android: How can i make unremovable local notification toolbar with some action button on it as shown in screenshot

在此处输入图像描述

i am seeking for an easy implementation and if it is possible without any extra package then it would be more helpfull我正在寻求一个简单的实现,如果没有任何额外的 package 是可能的,那么它会更有帮助

You need to use Services on Android side ( Official Documentation ).您需要在 Android 端使用Services官方文档)。

In few words, foreground service starts in app background (it can be separate process, depends on your features and specifics).简而言之,前台服务在应用程序后台启动(它可以是单独的进程,取决于您的功能和细节)。 Service cannot be started and live on Android device silently to user (you starting service and you have few second to pin it to notification, otherwise the system kill it immediately), you need to create a notification and pin service to it.服务无法启动并在 Android 设备上静默地运行给用户(您启动服务并且您有几秒钟的时间将其固定到通知,否则系统会立即将其终止),您需要创建一个通知并将服务固定到它。 In service you can update your notification by some action (user interact with notification and you updating it) or by time (per minute update battery level status, for example).在服务中,您可以通过某些操作(用户与通知交互并且您更新它)或时间(例如,每分钟更新电池电量状态)来更新您的通知。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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