Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在构建一个应用程序,该应用程序将在您扫描二维码时发出网络请求。如果您有可用的互联网,则提出该请求很容易。如果我们没有互联网,我想把它放到一个队列中,并在后台线程上有互联网时发出这些请求。处理此问题的最佳方法是什么以及我应该使用哪些库?
由于 Intent 是 Parcelables,我将使用 IntentService 来处理请求的 Intent,然后如果没有可用的 Internet 连接,则将其存储在文件或 sharedpreferences 中,此外,通过这种方法,您可以侦听连接广播,唤醒服务并重新启动队列,如果它已经打开,则通知用户完成或您自己的应用程序。