File tree Expand file tree Collapse file tree 1 file changed +14
-14
lines changed
app/src/main/java/com/fingerprintjs/android/fpjs_pro_demo Expand file tree Collapse file tree 1 file changed +14
-14
lines changed Original file line number Diff line number Diff line change @@ -46,20 +46,8 @@ class MainActivity : ComponentActivity() {
46
46
}
47
47
48
48
fun checkLocationPermissions () {
49
- if ((
50
- ActivityCompat .checkSelfPermission(
51
- this ,
52
- Manifest .permission.ACCESS_FINE_LOCATION
53
- ) == PackageManager .PERMISSION_GRANTED
54
- ) ||
55
- (
56
- ActivityCompat .checkSelfPermission(
57
- this ,
58
- Manifest .permission.ACCESS_COARSE_LOCATION
59
- ) == PackageManager .PERMISSION_GRANTED
60
- )
61
- ) {
62
- // We have at least some location permission, so we can proceed
49
+ if (isAnyLocationPermissionEnabled()) {
50
+ // We have at least some location permission, so we can proceed with getVisitorId
63
51
return
64
52
}
65
53
@@ -77,4 +65,16 @@ class MainActivity : ComponentActivity() {
77
65
)
78
66
)
79
67
}
68
+
69
+ private fun isAnyLocationPermissionEnabled (): Boolean {
70
+ return isPermissionGranted(Manifest .permission.ACCESS_FINE_LOCATION )
71
+ || isPermissionGranted(Manifest .permission.ACCESS_COARSE_LOCATION )
72
+ }
73
+
74
+ private fun isPermissionGranted (permission : String ): Boolean {
75
+ return ActivityCompat .checkSelfPermission(
76
+ this ,
77
+ permission
78
+ ) == PackageManager .PERMISSION_GRANTED
79
+ }
80
80
}
You can’t perform that action at this time.
0 commit comments