繁体   English   中英

如何更改 flutter_downloader package 的通知标题?

[英]How to change notification title for flutter_downloader package?

在我的应用程序中,我使用 flutter_downloader package 添加了 pdf 下载功能。

下面是我Function下载的一个文件。

static Future<String?> downloadPdf(String path, String downloadLink) async {
    final taskId = await FlutterDownloader.enqueue(
      url: downloadLink,
      savedDir: path,
      showNotification: true,
      openFileFromNotification: true,
      saveInPublicStorage: true,
    );

    return taskId;
  }

当我下载任何文件然后我收到通知但在通知中它显示文件路径如下图所示。

在此处输入图像描述

在上图中它显示了文件链接,那么我如何显示其他东西,比如你的文件已经下载到文件链接的位置?

注意:- 我的下载 api 链接基于 id 而不是文件名,例如 - "api/xyz/xyz/33"

请帮我。

谢谢你。

打开your-app/android/app/src/main/res/values/strings.xml如果你没有strings.xml只需创建它并添加这些字符串:

<resources>
  <string name="flutter_downloader_notification_started">Your notification_started message</string>
  <string name="flutter_downloader_notification_in_progress">Your notification_in_progress message</string>
  <string name="flutter_downloader_notification_canceled">Your notification_canceled message</string>
  <string name="flutter_downloader_notification_failed">Your notification_failed message</string>
  <string name="flutter_downloader_notification_complete">...</string>
  <string name="flutter_downloader_notification_paused">...</string>
  ...
</resources>

暂无
暂无

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

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