2015-04-13 65 views
3

在Android中更新地理圍欄的最佳方式是什麼?它是先刪除舊的一套地理圍欄,然後加入新的更新列表如下:Android更新地理柵欄

  LocationServices.GeofencingApi.removeGeofences(
        mGoogleApiClient, 
        getGeofencePendingIntent() 
      ).setResultCallback(this); 

      LocationServices.GeofencingApi.addGeofences(
        mGoogleApiClient, 
        getGeofencingRequest(), 
        getGeofencePendingIntent() 
      ).setResultCallback(this); // Result processed in onResult(). 

或者我能不能直接調用addGeofences無需取出舊的,並有新的取代舊的?

回答

6

如果您先閱讀說明書,你會發現addGeofences說:

如果用相同的請求ID的現有地理圍欄已經被註冊,舊地理圍欄被替換爲新的,並新的PendingIntent用於生成警報的意圖。

相關問題