NativeScript进度通知
进度通知插件允许您的应用程序在Android应用程序执行期间显示正常和进度通知。例如,文件下载或上传的通知。
npm i --save nativescript-progress-notifications

NativeScript进度通知(Android)

进度通知插件允许您的应用程序在Android应用程序执行期间显示正常和进度通知。例如,文件下载或上传的通知。

要求

仅适用于Android

安装

描述您的插件安装步骤。理想情况下,它可能如下

tns plugin add nativescript-progress-notifications

Typescript支持

并且,为了方便起见,请在您的nativeScript应用程序中添加Typescript支持

tns install typescript

现在您可以将插件作为对象导入到您的.ts文件中,如下所示

import * as ProgressNotification from 'nativescript-progress-notification';

// then use it as:
ProgressNotification.dismiss(id);

用法

```javascript
    let localNotification=ProgressNotification.show({
        id:5, //required
        title:"Progress Notification",
        message:"Working normal local Notification",
        ongoing:false,
    });

    let progressNotification=ProgressNotification.show({
        id:6, //required
        title:"progress Notification",
        message:"Working Progress Notification",
        ongoing:true,
        indeterminate:false,
        progressValue:20
    });

    let updateProgressNotification=ProgressNotification.update(progressNotification,{
        progressValue:50
    });

    let finishProgressNotification=ProgressNotification.update(progressNotification,{
        progressValue:100,
        message:"Process Completed",
        hideProgressBar:true, //set true to hide progressbar otherwise it will be visible
    });

    //dismiss notification
    ProgressNotification.dismiss(localNotification.id);

```

API

属性 默认值 描述
id 必需 一个数字,以便您可以轻松地区分您的通知。
title " " 显示在状态栏中的标题。
message " " 标题下的文本。
ongoing true 设置此是否为ongoing通知。进行中的通知不能被用户取消,因此您的应用程序必须负责取消它们。
indeterminate false 进行中通知类型indeterminate或不是。将true设置为将显示与进度值无关的连续运行进度条。
progressValue 0 ongoing为true且indeterminate为false时,设置通知进度。

许可证

Apache许可证版本2.0,2004年1月