Android FusedLocationProviderApi: Incoming intent has no LocationResult or LocationAvailability

前端 未结 3 1921
故里飘歌
故里飘歌 2021-02-14 06:10

I am trying to subscribe to location updates via Google\'s FusedLocationProviderApi. I want to receive updates in the background, so that I will receive updates even if the app

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2021-02-14 07:09

    A workaround (Christophe Beyls suggested that only Intent Data should be used) So, since I only need to send a few parameters, so I do something like this: while building the Intent before the requestLocationUpdates: intent.setData(Uri.parse("http://a.com/a?"+ Param1+ "?" + Param2+ "?" + Param3); and in the BroadcastReceiver: String[] parameters = intent.getDataString().split("[?]"); This works fine, and intent.getParcelableExtra(FusedLocationProviderApi.KEY_LOCATION_CHANGED) does return the location.

提交回复
热议问题