简体   繁体   English

Flutter应用内购买,每次重启应用如何查看是否已购买?

[英]For Flutter In-App-Purchase, how to check the purchase has been made each time app is restarted?

I'm testing my first Flutter In-App-Purchase app.我正在测试我的第一个 Flutter In-App-Purchase 应用程序。 Where should I store the purchased info after the purchase has been made so the app can check when it restarts each time?购买后我应该将购买的信息存储在哪里,以便应用程序可以检查每次重新启动的时间? If I store locally on a device, then the info will be lost after user clearing user data.如果我在设备上本地存储,则用户清除用户数据后信息将丢失。 If I store it remotely on firebase or other server, then the device has to be online to use the paid features.如果我将其远程存储在 firebase 或其他服务器上,则设备必须在线才能使用付费功能。 Can't seem to find what's the best solution.似乎找不到最好的解决方案。

It seems that _inAppPurchase.purchaseStream.listen only emits data stream when a purchase or a "restore previous purchase" is made not every time app is restated.似乎_inAppPurchase.purchaseStream.listen仅在进行购买或“恢复以前的购买”时才发出数据 stream ,而不是每次重述应用程序时。 Also, uninstalling and reinstalling app in Play Store doesn't automatically restore a previous purchase so I have to provide a button for manually restore the purchase.此外,在 Play 商店中卸载并重新安装应用程序并不会自动恢复以前的购买,因此我必须提供一个手动恢复购买的按钮。

_inAppPurchase.purchaseStream.listen is correct. _inAppPurchase.purchaseStream.listen 是正确的。

If you check it every time you run the app, a lot of traffic is generated.如果每次运行应用程序时都检查它,会产生大量流量。 So, after purchase, we store it locally.因此,购买后,我们将其存储在本地。 And if you uninstall and install the app, you need to use the processor that stores it locally again by restoring the purchase list.而如果你卸载并安装该应用程序,则需要通过恢复购买列表再次使用本地存储它的处理器。

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

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