Skip to content

Commit

Permalink
Merge pull request #889 from wtwsky/master
Browse files Browse the repository at this point in the history
* fix #620 bug and #864 bug
  • Loading branch information
bartekpacia authored May 6, 2024
2 parents c011438 + 9e45657 commit af6ec10
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 af6ec10

Please sign in to comment.