0

When I program apps, usually I need to do something that can fail (the most typical is send something to a server), many times the "send and forget" would be the best option (or a send and forget with a expiration date).

I know it is a very generic problem but is there some library that facilitates the save and retry process?

4

1 回答 1

0

正如@CodeChimp 所说,您可能需要自己动手。

也就是说,Android 通常的模式是编写一个处理保存/重试的服务。您的应用程序会将数据传递给服务(发送并忘记),然后服务将负责尝试在后台发送。

这类事情的最大问题始终是如何处理失败。保存失败多次后会发生什么?你在这里也是一个人。根据您的情况,您可以通知用户(通过通知),将错误保存在应用程序的数据库中,并在应用程序的 UI 中通知用户等...

于 2013-05-22T12:40:29.997 回答