Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/187.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 将OnAddGeofencesResultListener和OnRemoveGeofencesResultListener替换为OnSuccessListener_Java_Android_Geofencing - Fatal编程技术网

Java 将OnAddGeofencesResultListener和OnRemoveGeofencesResultListener替换为OnSuccessListener

Java 将OnAddGeofencesResultListener和OnRemoveGeofencesResultListener替换为OnSuccessListener,java,android,geofencing,Java,Android,Geofencing,我正在尝试更新一个旧的GeoFenging应用程序,以使用新的GeoFenging API(基于GeofencingClient),而不是旧的API(基于LocationClient——已弃用和删除)。旧的应用程序/API实现了OnAddGeofencesResultListener和OnRemoveGeofencesResultListener接口,而新的应用程序/API实现了OnCompleteListener和/或OnSuccessListener接口 旧接口的回调函数除了作为参数传递in

我正在尝试更新一个旧的GeoFenging应用程序,以使用新的GeoFenging API(基于
GeofencingClient
),而不是旧的API(基于
LocationClient
——已弃用和删除)。旧的应用程序/API实现了OnAddGeofencesResultListener和OnRemoveGeofencesResultListener接口,而新的应用程序/API实现了OnCompleteListener和/或OnSuccessListener接口

旧接口的回调函数除了作为参数传递
int statusCode
之外,还传递
pendingent
(即
字符串[]
):

  • @覆盖AddGeoFencesResult上的公共void(int statusCode,String[]GeoFenceRequestId)
  • @在RemoveGeoFencesByEndingIntentResult(int statusCode,PendingEvent requestIntent)上覆盖公共无效信息
  • @Override public void onremovegeofencesbyrequestdsresult(int statusCode,String[]geofinerequestids)
问题:是否有方法从新接口的回调(例如任务或覆盖)访问PendingEventGeoFenceRequestId

  • @覆盖已完成的公共void(@NonNull任务)
  • @成功时覆盖公共void(@NonNull Task voidTask)
我一直在使用这些参数来记录并将信息发送到应用程序的其他组件