根据购物车的状态按设定的时间间隔推送通知? /离子

Pushing notifications at set interval based on the state of the shopping cart? /Ionic

我们正在构建一个电子商务混合应用程序 (Ionic + Phonegap + Cordova),用户可以在其中将商品放入购物车然后再购买(类似于亚马逊和其他电子商务服务)。

为了鼓励用户完成购买,我们希望每天 "scan" 一次购物车,检查用户是否有一些商品在购物车中已放置超过 24 小时。

如果算法发现任何物品在购物车中超过 24 小时,他们将在每天下午 3 点通过推送通知收到通知。如果没有此类项目,则不会发送通知。如果有多个项目,将只发送 1 条通知说 "I see you have 2 items in the cart you haven't bought yet. What are you waiting for?"。

我是团队的非技术成员,工程师告诉我无法创建此类通知。

我被告知的内容,逐字记录:

Unfortunately, due to the Apple and Android settings, code can't be executed after the notification is shown. What that means is that we can't check in the background for any outstanding items from the past few days. The best thing we can do, is to plan a notification for the next day if user has opened the application and there are items in the cart. However, there is no way how to plan it for next X days.

建议的解决方案是这样的:

When the user adds a new item, all scheduled notifications [as mentioned above] will be deleted and new notifications will be calculated (it gets difficult in this part because of grouping items as we don't want to spam users with the notifications)

所以我的问题很简单 - 这是一个明智的解决方案吗?真的没有比这更有效的方法了吗?谢谢。

有两种类型的通知:

本地通知:

通知是在您的应用程序中创建的。一种策略可以是:

  • 有一个用于暂停的事件处理程序和另一个用于恢复的事件处理程序 应用程序。
  • 如果应用程序要暂停,您计算通知文本, 日期和时间,也许还有徽章。 ( "You have two item in …", 24 小时后显示。)
  • 如果应用恢复,您清除通知。

您可以创建多个通知,但如果应用不在前台,则无法进行重新计算。短时间内可以有一个后台进程,但不允许长时间有这个进程。 (特殊情况是 GPS 跟踪和计时器应用程序。)

推送通知:

此类通知由 Google、Apple 等通知提供商发送,...。因此,您必须将购物数据保存在您的服务器上,并向该提供商发送通知作业,然后由提供商将其发送给客户。

推送通知是比本地一次开发更大的工作。原因是,您必须管理购物数据、设备以及与通知服务器的通信。而且你会有很多垃圾和假数据。

我会从本地通知开始。,