Open NadeemKhanFh opened 1 month ago
react-native -v
Plugin config
React.useEffect(() => { /// 1. Subscribe to events. const onLocation: Subscription = BackgroundGeolocation.onLocation( (location) => { // console.log('[onLocation]', location); setLocationData({ lat: location?.coords?.latitude, long: location?.coords?.longitude, }); setIs_moving(location?.is_moving); } ); const onMotionChange: Subscription = BackgroundGeolocation.onMotionChange( (event) => { // console.log('[onMotionChange]', event); } ); const onActivityChange: Subscription = BackgroundGeolocation.onActivityChange((event) => { // console.log('[onActivityChange]', event); }); const onProviderChange: Subscription = BackgroundGeolocation.onProviderChange((event) => { // console.log('[onProviderChange]', event); }); const onHttp = BackgroundGeolocation.onHttp((httpEvent) => { //console.log('[http] ', httpEvent); }); const onAuthorization = BackgroundGeolocation.onAuthorization( (httpEvent) => { // console.log('[onAuthorization] ', httpEvent); } ); /// 2. ready the plugin. BackgroundGeolocation.ready({ locationAuthorizationRequest: 'Always', disableLocationAuthorizationAlert: false, backgroundPermissionRationale: { title: "Allow Cheezious to access this device's location in the background?", message: 'In order to track your activity in the background, please enable your backgoround location permission', positiveAction: 'Allow', negativeAction: 'Cancel', }, notification: { title: 'Background Location Tracking', text: 'We are tracking your location to provide real-time updates.', }, // Geolocation Config desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH, distanceFilter: 100, // Activity Recognition stopTimeout: 5, // Application config debug: false, // <-- enable this hear sounds for background-geolocation life-cycle. logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, stopOnTerminate: false, // <-- Allow the background-service to continue tracking when user closes the app. startOnBoot: true, // <-- Auto start tracking when device is powered-up. // HTTP / SQLite config batchSync: false, // <-- [Default: false] Set true to sync locations to server in a single HTTP request. autoSync: true, // <-- [Default: true] Set true to sync each location to server as it arrives. enableHeadless: true, url: `${Config.API_URL}riders/update/location`, method: 'POST', headers: { authorization: 'Bearer ' + token ?? '', }, }) .then((state) => { console.log( '- BackgroundGeolocation is configured and ready: ', state.enabled ); if (!state.enabled) { BackgroundGeolocation.start(); } }) .catch((error) => { console.log('- BackgroundGeolocation error: ', error); if (error === 'Permission denied') { setShowLocationModal(true); } }); return () => { // Remove BackgroundGeolocation event-subscribers when the View is removed or refreshed // during development live-reload. Without this, event-listeners will accumulate with // each refresh during live-reload. onLocation.remove(); onMotionChange.remove(); onActivityChange.remove(); onProviderChange.remove(); onHttp.remove(); onAuthorization.remove(); }; }, []);
It should not crash in production
its happening in production, i am sending screenshots 1. 2. 3. 4.
@christocracy ?? can you please comment on this?
Have you tried searching the issues for that error?
This issue is stale because it has been open for 30 days with no activity.
Your Environment
react-native -v
): "^0.74.5",Plugin config
Expected Behavior
It should not crash in production
Actual Behavior
It should not crash in production
Steps to Reproduce
its happening in production, i am sending screenshots 1. 2. 3. 4.
Context
Debug logs
Logs
``` PASTE_YOUR_LOGS_HERE ```