Skip to content

Commit

Permalink
* fix Lyokone#620 bug and Lyokone#864 bug
Browse files Browse the repository at this point in the history
  • Loading branch information
温天伟 committed Aug 22, 2023
1 parent 9c96830 commit 9e45657
Showing 1 changed file with 10 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ public void onReattachedToActivityForConfigChanges(@NonNull ActivityPluginBindin
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
Log.d(TAG, "Service connected: " + name);
initialize(((FlutterLocationService.LocalBinder) service).getService());
if(service instanceof FlutterLocationService.LocalBinder){
initialize(((FlutterLocationService.LocalBinder) service).getService());
}
}

@Override
Expand Down Expand Up @@ -114,12 +116,14 @@ private void dispose() {
methodCallHandler.setLocationService(null);
methodCallHandler.setLocation(null);

activityBinding.removeRequestPermissionsResultListener(locationService.getServiceRequestPermissionsResultListener());
activityBinding.removeRequestPermissionsResultListener(locationService.getLocationRequestPermissionsResultListener());
activityBinding.removeActivityResultListener(locationService.getLocationActivityResultListener());
if(locationService != null){
activityBinding.removeRequestPermissionsResultListener(locationService.getServiceRequestPermissionsResultListener());
activityBinding.removeRequestPermissionsResultListener(locationService.getLocationRequestPermissionsResultListener());
activityBinding.removeActivityResultListener(locationService.getLocationActivityResultListener());

locationService.setActivity(null);
locationService.setActivity(null);

locationService = null;
locationService = null;
}
}
}

0 comments on commit 9e45657

Please sign in to comment.