了解Android中的Firebase快照侦听器定价 [英] understanding firebase snapshot listener pricing in android

查看:65
本文介绍了了解Android中的Firebase快照侦听器定价的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个课程应用程序,其中显示了特定课程的模块列表.每个模块都有其进度.他们总结为整个课程的进度.在这里,我将显示此列表中每个模块与模块的进度.我的流程是这样的:我打开模块以完成它.->所选模块的特定进度文档已更新.现在,当我返回上一个活动并看到我在模块中所做的更新反映在这里时,我在这里使用了快照侦听器.那么对他们来说如何计算成本呢?它只会从更新的进度文档中收取费用吗?如果我的用户杀死了该应用程序,该怎么办重新启动.并再次沿着同一路线前进.因为我正在使用快照侦听器来学习课程,模块和进度,所以即使重新启动应用程序但数据没有更改,它也会向我收费.还是不?

I have a course app in which I show the module list for a particular course. each module has its progress. and they sum up as total course progress. here I show progress for each module in this list with the module. My flow is like this: I open module complete it.--> A particular progress document for the selected module is updated. now when I come back to prev activity and to see an update I made in module reflecting here, I have used snapshot Listeners here. So how costing will work for them? will it only charge fro the updated progress doc? what if my user kills the app restarts again. and comes again on the same course. as I am using a snapshot listener for courses, modules, and progress .. will it charge me even if the app is restarted but data is not changed. or not?

推荐答案

因为我正在使用快照侦听器来跟踪课程,模块和进度,所以即使应用程序重新启动但数据没有更改,它也会向我收取费用.还是不?

as I am using a snapshot listener for courses, modules, and progress, will it charge me even if the app is restarted but data is not changed. or not?

是的.如果没有条件地连接快照侦听器,则它将需要读取所有文档以确定它们是否已更改.因此,尽管未对未修改文档的带宽使用进行收费,但此时您将需要为读取操作付费.

Yes. If you attach a snapshot listener without a condition, it will need to read all documents to determine whether they have changed. So at that point you will be charged for the read operation, although you may not be charged for bandwidth usage for unmodified documents.

如果您想避免这种情况:

If you want to prevent this:

  1. 确保每个文档都有一个类似 lastModified 的字段,该字段带有创建/上次修改时间的时间戳.
  2. 仅查询自您的应用程序上次运行以来被修改的文档.
  3. 将应用最后一次读取数据的时间存储在本地存储中,以便在应用运行之间将其持久化.
  1. Ensure that each document has a field like lastModified that has the timestamp of when it was created/last modified.
  2. Only query for documents that were modified since your app last ran.
  3. Store the time the app last read data in local storage, so that it is persisted between runs of your app.

这篇关于了解Android中的Firebase快照侦听器定价的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆