Comments (10)
Likely because of this unnecessary and unawait
ed .changePace(false) before calling .stop().
BackgroundGeolocation.changePace(false);
BackgroundGeolocation.stop();
from react-native-background-geolocation.
Calling changePace can take several seconds to complete, where the plug-in waits for at least 3 locations to arrive, choosing the highest possible accuracy.
completely unnecessary when you’re just going to call .stop right after.
from react-native-background-geolocation.
Thank you for your response. I removed changePace, but the problem still persists.
I will try a few more times!
from react-native-background-geolocation.
The problem is in your own code.
calling .getCurrentPosition launches a foreground service too.
from react-native-background-geolocation.
I made a simple switch that toggles start and stop, but the problem still exists.
Code
function SettingRunningPage() {
const [switchValue, setSwitchValue] = useState(false);
const [changedPace, setChangedPace] = useState(false);
const onChangeValue = async (newValue: boolean) => {
if (newValue) {
BackgroundGeolocation.start((state) => {
if (state.enabled) {
BackgroundGeolocation.changePace(true, () => {
setChangedPace(true);
});
}
});
} else {
BackgroundGeolocation.stop(
(s) => {
console.log(s);
setChangedPace(false);
},
(e) => {
console.log(e);
},
);
}
setSwitchValue(newValue);
};
return (
<AppLayout Header={<NormalHeader title={'BackgroundGeolocation'} />} backgroundColor={COLORS.white} safeAreaEnabled>
<View style={{ flex: 1, backgroundColor: COLORS.white, paddingTop: 16 }}>
<SettingRow title={'BackgroundGeolocation'}>
<SwitchButton value={switchValue} onChangeValue={onChangeValue} />
<Text type="Body1_400">{`changedPace: ${changedPace}`}</Text>
</SettingRow>
</View>
</AppLayout>
);
}
video_playspeedx2.mp4
from react-native-background-geolocation.
You do not need to .changePace when you’re calling .stop()!!
calling .stop() stops everything.
Just delete all calls to .changePace when you’re stopping the plug-in.
from react-native-background-geolocation.
It's not BackgroundGeolocation.changePace, It's just useState setState to show the text changedPace
from react-native-background-geolocation.
Create for me a simple hello-world in a freshly generated app which reproduces it. Share it with me in a public GitHub repo.
from react-native-background-geolocation.
If this is not enough, I would like to suggest creating a forkable Hello World app with all the settings configured. This would make it easier for other users to create reproducible examples as well.
I’ll try to create a Hello World app and let you know
from react-native-background-geolocation.
If this is not enough
No. I believe the problem is in your own code.
from react-native-background-geolocation.
Related Issues (20)
- State change HOT 12
- Question about preventSuspend HOT 5
- Basic Doubts HOT 6
- Expo integration HOT 6
- Post Payload Optimization HOT 2
- Permissions in Background Tracking HOT 5
- Start Tracking on Closed Application HOT 8
- App Hanging -[TSLocationManager queue:type:] HOT 17
- Permissions
- StopTimeout not Working HOT 13
- Background Location not detecting on few devices like Oneplus , Apple Iphone 15 pro HOT 3
- Background Location not detecting on few devices like Oneplus , Apple Iphone 15 pro HOT 1
- Background Location Stop Detecting Very Late After Stopped HOT 1
- Background Location Stop Detecting Very Late After Stopped HOT 4
- java.lang.IncompatibleClassChangeError upon update from Expo SDK 49 to 51 HOT 1
- The operation couldn’t be completed. Background procssing task was not registered in AppDelegate didFinishLaunchingWithOptions. See iOS Setup Guide. HOT 1
- Realtime Database Firebase HOT 10
- Strange background location indicator - can't turn off HOT 4
- onEnabled and onGeofence not triggering on production but does work on development HOT 2
- Schedule is not working as expected in IOS HOT 11
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-background-geolocation.