File tree 2 files changed +9
-4
lines changed
android/src/main/java/com/baseflow/geolocator/location
2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
1
package com .baseflow .geolocator .location ;
2
2
3
+ import android .Manifest ;
3
4
import android .annotation .SuppressLint ;
4
5
import android .annotation .TargetApi ;
5
6
import android .content .Context ;
7
+ import android .content .pm .PackageManager ;
6
8
import android .location .GnssStatus ;
7
9
import android .location .Location ;
8
10
import android .location .LocationManager ;
@@ -73,9 +75,12 @@ public void start() {
73
75
74
76
if (locationOptions != null ) {
75
77
if (Build .VERSION .SDK_INT >= Build .VERSION_CODES .N && locationManager != null ) {
76
- locationManager .addNmeaListener (nmeaMessageListener , null );
77
- locationManager .registerGnssStatusCallback (gnssCallback , null );
78
- listenerAdded = true ;
78
+ if (context .checkSelfPermission (Manifest .permission .ACCESS_FINE_LOCATION )
79
+ == PackageManager .PERMISSION_GRANTED ) {
80
+ locationManager .addNmeaListener (nmeaMessageListener , null );
81
+ locationManager .registerGnssStatusCallback (gnssCallback , null );
82
+ listenerAdded = true ;
83
+ }
79
84
}
80
85
}
81
86
}
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.6.0
5
+ version : 4.6.1
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