如何使用android Fuse api获取位置

时间:2016-08-08 11:52:29

标签: android google-api

如何使用Android google API查找当前位置? 我用了这段代码:

GoogleApiClient googleApiClient = new GoogleApiClient.Builder(this)
            .enableAutoManage(this, 0 , this)
            .addConnectionCallbacks(this)
            .addOnConnectionFailedListener(this)
            .build();
LocationServices.FusedLocationApi.getLastLocation(googleApiClient);

但这不起作用。怎么了?

1 个答案:

答案 0 :(得分:1)

你忘记了这一行:

googleApiClient.addApi(LocationServices.API)