我们可以在单个 intentservice onHandleIntent() 中使用多个 Web 服务调用吗?
Can we use multiple webservice call in single intentservice's onHandleIntent()?
据我所知,intentservice 的 OnHandleIntent 运行 在单独的线程上,与 asynctask 一样,所以我们可以在单个 IntentService 中使用两个或多个 webservice 调用吗?如果我们这样做.. android 将如何执行两个 webservice 调用?意思是 return 第一个 webserive 调用的结果然后执行另一个?
您可以,尽可能多地在单独的线程中执行多个同步 http 调用。
需要注意的是,您需要执行 synchronous http 调用(如果您使用 okhttp 或 retrofit,您需要寻找阻塞的味道)并且它们显然会被序列化。
您可以一次调用多个网络服务 IntentService
据我所知,intentservice 的 OnHandleIntent 运行 在单独的线程上,与 asynctask 一样,所以我们可以在单个 IntentService 中使用两个或多个 webservice 调用吗?如果我们这样做.. android 将如何执行两个 webservice 调用?意思是 return 第一个 webserive 调用的结果然后执行另一个?
您可以,尽可能多地在单独的线程中执行多个同步 http 调用。 需要注意的是,您需要执行 synchronous http 调用(如果您使用 okhttp 或 retrofit,您需要寻找阻塞的味道)并且它们显然会被序列化。
您可以一次调用多个网络服务 IntentService