gpt4 book ai didi

android - 从服务 : alternate flow of events 使用 Google Play 服务

转载 作者:行者123 更新时间:2023-11-30 02:52:03 24 4
gpt4 key购买 nike

我正在开发一项服务,它将使用 Google Play 服务 中的 LocationClient 跟踪用户的位置。一切正常,所以现在我想考虑备用事件流,例如:

  1. 用户的手机上没有 Play 服务
  2. 用户甚至没有 Google Play 商店,但仍在使用 Market 应用
  3. 如何处理上述两种会触发 onConnectionFailed()
  4. 的不同情况
  5. 除非满足特定条件,否则不应停止 Service,因此 onDisconnect() 甚至会被调用(因为 LocationClient#disconnect( ) 不被调用)

通常,在 Activity 中执行此操作时,您只需显示一个 Dialog(来自 GooglePlayServicesUtil.getErrorDialog() )或类似于让用户知道,但由于这是一个 Service,没有与之相关的 Activity,我应该如何处理这种错误

最佳答案

创建并显示来自您的服务的通知。当用户点击它时,会显示描述错误/失败的 Activity

关于android - 从服务 : alternate flow of events 使用 Google Play 服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23980465/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com