File tree Expand file tree Collapse file tree 6 files changed +44
-5
lines changed
android/src/main/java/com/baseflow/geolocator Expand file tree Collapse file tree 6 files changed +44
-5
lines changed Original file line number Diff line number Diff line change
1
+ ## 4.5.5
2
+
3
+ * Fixes a bug where location stream is not automatically started when enabling the location services.
4
+
1
5
## 4.5.4
2
6
3
7
* Fixes a bug where the ` getPositionStream ` was not informed of the location service resolution result. This resulted in a stream that was kept open indefinitely.
Original file line number Diff line number Diff line change @@ -56,9 +56,9 @@ public void onServiceDisconnected(ComponentName name) {
56
56
@ Nullable private ActivityPluginBinding pluginBinding ;
57
57
58
58
public GeolocatorPlugin () {
59
- permissionManager = new PermissionManager ();
60
- geolocationManager = new GeolocationManager ();
61
- locationAccuracyManager = new LocationAccuracyManager ();
59
+ permissionManager = PermissionManager . getInstance ();
60
+ geolocationManager = GeolocationManager . getInstance ();
61
+ locationAccuracyManager = LocationAccuracyManager . getInstance ();
62
62
}
63
63
64
64
@ Override
Original file line number Diff line number Diff line change 18
18
public class GeolocationManager
19
19
implements io .flutter .plugin .common .PluginRegistry .ActivityResultListener {
20
20
21
+ private static GeolocationManager geolocationManagerInstance = null ;
22
+
21
23
private final List <LocationClient > locationClients ;
22
24
23
- public GeolocationManager () {
25
+ private GeolocationManager () {
24
26
this .locationClients = new CopyOnWriteArrayList <>();
25
27
}
26
28
29
+ public static synchronized GeolocationManager getInstance () {
30
+ if (geolocationManagerInstance == null ) {
31
+ geolocationManagerInstance = new GeolocationManager ();
32
+ }
33
+
34
+ return geolocationManagerInstance ;
35
+ }
36
+
27
37
public void getLastKnownPosition (
28
38
Context context ,
29
39
boolean forceLocationManager ,
Original file line number Diff line number Diff line change 11
11
12
12
public class LocationAccuracyManager {
13
13
14
+ private LocationAccuracyManager () {}
15
+
16
+ private static LocationAccuracyManager locationAccuracyManagerInstance = null ;
17
+
18
+ public static synchronized LocationAccuracyManager getInstance () {
19
+ if (locationAccuracyManagerInstance == null ) {
20
+ locationAccuracyManagerInstance = new LocationAccuracyManager ();
21
+ }
22
+
23
+ return locationAccuracyManagerInstance ;
24
+ }
25
+
14
26
public LocationAccuracyStatus getLocationAccuracy (Context context , ErrorCallback errorCallback ) {
15
27
if (ContextCompat .checkSelfPermission (context , Manifest .permission .ACCESS_FINE_LOCATION )
16
28
== PackageManager .PERMISSION_GRANTED ) {
Original file line number Diff line number Diff line change 16
16
import com .baseflow .geolocator .errors .ErrorCodes ;
17
17
import com .baseflow .geolocator .errors .PermissionUndefinedException ;
18
18
19
+ import java .security .Permission ;
19
20
import java .util .*;
20
21
21
22
@ SuppressWarnings ("deprecation" )
22
23
public class PermissionManager
23
24
implements io .flutter .plugin .common .PluginRegistry .RequestPermissionsResultListener {
24
25
26
+ private PermissionManager () {}
27
+
25
28
private static final int PERMISSION_REQUEST_CODE = 109 ;
26
29
30
+ private static PermissionManager permissionManagerInstance = null ;
31
+
27
32
@ Nullable private Activity activity ;
28
33
@ Nullable private ErrorCallback errorCallback ;
29
34
@ Nullable private PermissionResultCallback resultCallback ;
30
35
36
+ public static synchronized PermissionManager getInstance () {
37
+ if (permissionManagerInstance == null ) {
38
+ permissionManagerInstance = new PermissionManager ();
39
+ }
40
+
41
+ return permissionManagerInstance ;
42
+ }
43
+
31
44
public LocationPermission checkPermissionStatus (Context context )
32
45
throws PermissionUndefinedException {
33
46
List <String > permissions = getLocationPermissionsFromManifest (context );
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ name: geolocator_android
2
2
description : Geolocation plugin for Flutter. This plugin provides the Android implementation for the geolocator.
3
3
repository : https://github.com/baseflow/flutter-geolocator/tree/main/geolocator_android
4
4
issue_tracker : https://github.com/baseflow/flutter-geolocator/issues?q=is%3Aissue+is%3Aopen
5
- version : 4.5.4
5
+ version : 4.5.5
6
6
7
7
environment :
8
8
sdk : " >=2.15.0 <4.0.0"
You can’t perform that action at this time.
0 commit comments