-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request transistorsoft#294 from transistorsoft/android-onD…
…estroy Refactor Android onDestroy; Implementing Android Location Authorization
- Loading branch information
Showing
12 changed files
with
88 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { | ||
PermissionsAndroid | ||
} from "react-native" | ||
|
||
import API from "./RNBackgroundGeolocation"; | ||
|
||
const ACCESS_FINE = PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION; | ||
const ACCESS_COARSE = PermissionsAndroid.PERMISSIONS.ACCESS_COARSE_LOCATION; | ||
|
||
async function requestPermission(success, failure) { | ||
try { | ||
const granted = await PermissionsAndroid.requestMultiple([ACCESS_FINE, ACCESS_COARSE]); | ||
|
||
if ((granted[ACCESS_FINE] === PermissionsAndroid.RESULTS.GRANTED) && (granted[ACCESS_COARSE] === PermissionsAndroid.RESULTS.GRANTED)) { | ||
success(); | ||
} else { | ||
console.warn("ACCESS_FINE_LOCATION permission denied"); | ||
failure(1); | ||
} | ||
} catch (err) { | ||
console.warn(err); | ||
} | ||
} | ||
|
||
async function checkPermission(success, failure) { | ||
PermissionsAndroid.check(ACCESS_FINE).then(isAuthorized => { | ||
if (isAuthorized) { return success(); } | ||
requestPermission(success, failure); | ||
}); | ||
} | ||
|
||
API.setPermissionsHandler(checkPermission); | ||
|
||
module.exports = API; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import API from "./RNBackgroundGeolocation"; | ||
|
||
module.exports = API; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+13.3 KB
(100%)
ios/RNBackgroundGeolocation/TSLocationManager.framework/TSLocationManager
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
ios/RNBackgroundGeolocation/TSLocationManager.framework/_CodeSignature/CodeDirectory
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
ios/RNBackgroundGeolocation/TSLocationManager.framework/_CodeSignature/CodeRequirements-1
Binary file not shown.
Binary file modified
BIN
+0 Bytes
(100%)
ios/RNBackgroundGeolocation/TSLocationManager.framework/_CodeSignature/CodeSignature
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters