uma*_*ala 6 java mysql android server-side android-studio
我们可以访问用户,GoogleApiClient因为他/她从谷歌帐户登录.下面的代码在当前登录的用户上创建了Geofence.例如,用户A登录到应用程序并且我们可以访问GoogleApiClient,因此使用addGeofences函数创建地理围栏,该参数将参数作为mGoogleApiClient(当前用户的GoogleApiClient).
如何在用户B上创建地理围栏?如何访问他/她的GoogleApiClient以在用户B上创建地理围栏?简而言之,我们如何为其他用户创建地理围栏?请帮忙!
public void addGeofencesButtonHandler(View view) {
if (!mGoogleApiClient.isConnected()) {
Toast.makeText(this, getString(R.string.not_connected), Toast.LENGTH_SHORT).show();
return;
}
try {
populateGeofenceList();// creates geofence from list
LocationServices.GeofencingApi.addGeofences(
mGoogleApiClient,
// The GeofenceRequest object.
getGeofencingRequest(),
// A pending intent that that is reused when calling removeGeofences(). This
// pending intent is used to generate an intent when a matched geofence
// transition is observed.
getGeofencePendingIntent()
).setResultCallback(this); // Result processed in onResult().
} catch (SecurityException securityException) {
// Catch exception generated if the app does not use ACCESS_FINE_LOCATION permission.
logSecurityException(securityException);
}
}
Run Code Online (Sandbox Code Playgroud)
我也有同样的问题,我现在想到的想法是:
或者
我在 google geofence api 中搜索了很多,但找不到任何关于如何在另一个位置点“不是当前设备位置”上使用 api 的有用信息
注意:
这里的答案向您展示如何手动实现地理围栏:
除了Android API之外,还有其他API可以计算地理围栏违规吗
我在这里问了一个像你这样的问题,答案可能会有帮助:
Android: How to make user create geofence for another tracked users?
| 归档时间: |
|
| 查看次数: |
399 次 |
| 最近记录: |