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
温天伟 authored and tanvir-ahmed-m4 committed May 30, 2024
1 parent 0a8a52b commit 894b045
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 894b045

Please sign in to comment.