【问题标题】:Ionic Local Notifications离子本地通知
【发布时间】:2023-03-08 22:00:01
【问题描述】:

我有一个无法解决的问题。 我用 woocommerce 创建了一个电子商务。我使用 onesignla 发送更新通知等。 但是我希望每个用户在订单更改状态时都有自己的通知,例如: 从收到到完成... 我已尝试使用 localnotification,但没有成功,有人可以帮助我吗?

我的订单页面.ts

orderstatus: any;

orderChangeStatus(){
    if (this.orderstatus == 'processing') {
      this.LocalNotifications.schedule({
        title: 'My first notification',
        text: 'flight is landed',
        foreground: true

      });
    }
    if (this.orderstatus == 'completed') {
      this.LocalNotifications.schedule({
        title: 'My first completed',
        text: 'flight is landed',
        foreground: true

      });
    }

  }

html

    </ion-row>
    <ion-row [class.pending]="order.status=='pending' || order.status=='refunded'"
      [class.cancel]="order.status=='cancelled' || order.status=='failed'"
      [class.inprocess]="order.status=='processing'" [class.complete]="order.status=='completed'">
      <ion-col size="6">
        {{'Status'|translate}}
      </ion-col>
      <ion-col class="ion-text-right" size="6">
        <strong>{{order.status|translate}}</strong>
      </ion-col>
    </ion-row>

【问题讨论】:

    标签: ionic-framework localnotification


    【解决方案1】:

    Ionic Local Notifications 用于从应用程序本身触发的通知,没有推送通知服务器(例如,日历提醒)。它们不适合推送通知,除非您使用后台工作人员设置了自己的推送通知框架。

    您应该改用 Ionic OneSignal 插件。在此处查找文档:https://ionicframework.com/docs/native/onesignal

    现阶段我无法为您提供更多帮助,您应该尝试使用此插件,如果您还有其他问题,请提出其他问题。

    【讨论】:

    • with onesignal 不会自动处理订单还是我错了?
    • 推送通知应该从后端触发,而不是应用程序
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-03-20
    • 1970-01-01
    • 2020-01-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-03-08
    相关资源
    最近更新 更多