Android FusedLocationProviderApi: Incoming intent has no LocationResult or LocationAvailability

前端 未结 3 1919
故里飘歌
故里飘歌 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:06

    You can use:

    int id = 7;
    String name = "myName";
    uriBuilder.scheme("http")
                .authority("workaround.com")
                .appendPath("extra")
                .appendQueryParameter("id", String.valueOf(id))
                .appendQueryParameter("name", name);
    intent.setData(uriBuilder.build());
    

    and

    @Override
    protected void onHandleIntent(Intent intent) {
        if (LocationResult.hasResult(intent)) {
            int id = Integer.valueOf(uri.getQueryParameter("id"));
            String name = uri.getQueryParameter("name");
            ....
        }
    }
    

提交回复
热议问题