首頁>Program>source

更新到Google Play服務6.5.87後,由於缺少LocationCLient類,我的應用無法編譯。

文件鏈接目前已损壞(404否 找到)

我该如何解決? 我想接收位置更新,使用地理圍欄等。

最新回復
  • 5月前
    1 #

    LocationClient類已被新的FusedLocationProviderApi和GeofencingApi取代,它们都使用通用的GoogleApiClient連線技術来連線到Google Play 服務.建立連線後,您可以呼叫诸如requestLocationUpdates()之類的方法:

    LocationRequest locationRequest = LocationRequest.create()
        .setPriority(LocationRequest.PRIORITY_HIGH_ACCURACY);
    PendingResult<Status> result = LocationServices.FusedLocationApi
        .requestLocationUpdates(
            googleApiClient,   // your connected GoogleApiClient
            locationRequest,   // a request to receive a new location
            locationListener); // the listener which will receive updated locations
    // Callback is asynchronous. Use await() on a background thread or listen for
    // the ResultCallback
    result.setResultCallback(new ResultCallback<Status>() {
        void onResult(Status status) {
            if (status.isSuccess()) {
                // Successfully registered
            } else if (status.hasResolution()) {
                // Google provides a way to fix the issue
                status.startResolutionForResult(
                    activity,     // your current activity used to receive the result
                    RESULT_CODE); // the result code you'll look for in your
                                  // onActivityResult method to retry registering
            } else {
                // No recovery. Weep softly or inform the user.
                Log.e(TAG, "Registering failed: " + status.getStatusMessage());
            }
       }
    });
    

  • sorting:如何在MATLAB中针對一列對二維陣列排序?
  • .net:C#或滑動視窗列舉器中的成對迭代