react-native-background-geolocation
react-native-background-geolocation copied to clipboard
SIGSEV crash on setPace
Your Environment
- Plugin version: 4.7.1
- Platform: iOS
- OS version: 15.6.1
- Device manufacturer / model: iphone
- React Native version (
react-native -v): 0.68.2 - Plugin config
reset: true,
debug: false,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
distanceFilter: 0,
locationUpdateInterval: 5000,
stopOnTerminate: false,
startOnBoot: true,
disableStopDetection: true,
pausesLocationUpdatesAutomatically: false,
url: `${BASE_URL}/carrier/locationsV2`,
batchSync: true,
autoSyncThreshold: 5,
headers: {
'Authorization': `Bearer ${token}`,
},
disableLocationAuthorizationAlert: true,
locationAuthorizationAlert: {
titleWhenNotEnabled: "Location services are enabled for auto check in functionality",
titleWhenOff: "Location services disabled",
instructions: "You must enable 'Always' in location-services to allow for auto check in",
cancelButton: "Disable auto check in",
settingsButton: "Settings"
}
Expected Behavior
App should not crash
Actual Behavior
App crashes with sigsev. Stack trace attached
Steps to Reproduce
Context
Debug logs
Logs
Plugin version: latest
Meaningless. Provide exact version
Create for me a simple Hello World app which reproduces this crash.
Also, if .changePace is causing a crash, you should show all your javascript involved with that.
const App = () => {
const appState = useRef(AppState.currentState);
React.useEffect(() => {
initBackgroundGeolocation();
}, []);
/// Configure the BackgroundGeolocation plugin.
const initBackgroundGeolocation = async () => {
const authToken = await AsyncStorageNative.getItem('token');
let token = ''
try {
if (token != null) {
const parsed = JSON.parse(authToken);
token = parsed.token;
}
} catch (e) {
console.log(e)
}
let config = {
reset: true,
debug: false,
logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
distanceFilter: 0,
locationUpdateInterval: 5000,
stopOnTerminate: false,
startOnBoot: true,
disableStopDetection: true,
pausesLocationUpdatesAutomatically: false,
url: `${BASE_URL}/carrier/locationsV2`,
batchSync: true,
autoSyncThreshold: 5,
headers: {
'Authorization': `Bearer ${token}`,
},
disableLocationAuthorizationAlert: true,
locationAuthorizationAlert: {
titleWhenNotEnabled: "Location services are enabled for auto check in functionality",
titleWhenOff: "Location services disabled",
instructions: "You must enable 'Always' in location-services to allow for auto check in",
cancelButton: "Disable auto check in",
settingsButton: "Settings"
}
}
BackgroundGeolocation.onMotionChange((event) => {
event.isMoving ? BackgroundGeolocation.setConfig({
autoSyncThreshold: 20,
}) : BackgroundGeolocation.setConfig({
autoSyncThreshold: 5,
}
)
})
BackgroundGeolocation.onProviderChange((event) => {
NewRelic.setAttribute('location_permission', event.status)
});
BackgroundGeolocation.onHttp((event) => {
if (event.status === 401) {
AsyncStorageNative.getItem('token').then((token) => {
if (token == null) {
return;
}
const parsed = JSON.parse(authToken);
token = parsed.token;
BackgroundGeolocation.getState().then(() => {
BackgroundGeolocation.setConfig({
headers: {
'Authorization': `Bearer ${token}`,
}
})
});
});
}
NewRelic.setAttribute('location_permission', event.status)
});
BackgroundGeolocation.ready(config, (async state => {
await BackgroundGeolocation.start()
await BackgroundGeolocation.changePace(true)
if (state.isMoving) {
await BackgroundGeolocation.setConfig({
autoSyncThreshold: 20,
})
}
}));
};
if(appState.current === "background") {
return null
}
return (
<Home />
);
};
export default App;
Create for me a simple Hello World app which reproduces this crash.
I will try.
I am not able to repro on a sample app. Is there any glaring you see in code?
This issue is stale because it has been open for 30 days with no activity.
This issue was closed because it has been inactive for 14 days since being marked as stale.