react-native-background-geolocation icon indicating copy to clipboard operation
react-native-background-geolocation copied to clipboard

how to disable the beep sound in real application when app was terminated i used "Config.debug:false". But it is not working .

Open lavanyasree-ch opened this issue 1 year ago • 5 comments

BackgroundGeolocation.ready({ desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH, distanceFilter: 5, disableElasticity: true, stopTimeout: null, heartbeatInterval: 60, preventSuspend: true, locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER, locationAuthorizationRequest: 'Always', debug: false, // <-- enable this hear sounds for background-geolocation life-cycle. logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE, stopOnTerminate: true, // <-- Allow the background-service to continue tracking when user closes the app. startOnBoot: true, // <-- Auto start tracking when device is powered-up. 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. })

lavanyasree-ch avatar Dec 27 '23 11:12 lavanyasree-ch

You must call .ready(config) EACH time your app launches, regardless of anything.

Are you sure that's the exact Config you're using in your app?

christocracy avatar Dec 29 '23 14:12 christocracy

This is my component i am calling this component. Yes i am using exact below config?

ISSUES: 1. App giving beep sound every time when location is tracking in android. How to disable beep sounds? 2. BackgroundGeolocation is not working when terminate and reopen the app . But it is working when we are terminate and re-open multiple times. It is happening only in ANDROID, IOS is working fine

export default function App() {

const [enabled, setEnabled] = React.useState(false);


React.useEffect(() => {

const onHeartBeat = BackgroundGeolocation.onHeartbeat((event) => {
  console.log("[onHeartbeat] ", new Date().getMinutes(), event);
  // You could request a new location if you wish.
  BackgroundGeolocation.getCurrentPosition({
    samples: 1,
    persist: true
  }).then(async (location) => {
    const get_data = await AsyncStorage.getItem('location_data');
    const existingDataArray = get_data ? JSON.parse(get_data) : [];
    const newDataArray = typeof location === 'object'
      ? [...existingDataArray, location]
      : [...existingDataArray];
    await AsyncStorage.setItem('location_data', JSON.stringify(newDataArray));
  });
});

BackgroundGeolocation.ready({
  // Geolocation Config
  desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
  distanceFilter: 5,
  disableElasticity: true,
  // Activity Recognition
  stopTimeout: null,
  heartbeatInterval: 60,
  preventSuspend: true,
  locationProvider: BackgroundGeolocation.ACTIVITY_PROVIDER,
  locationAuthorizationRequest: 'Always',
  debug: false, // <-- enable this hear sounds for background-geolocation life-cycle.
  logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
  stopOnTerminate: true,   // <-- Allow the background-service to continue tracking when user closes the app.
  startOnBoot: true,        // <-- Auto start tracking when device is powered-up.
  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.
}).then((state) => {
  BackgroundGeolocation.start()
});
     return () => {
        onHeartBeat.remove()
     }
  }, []);

   return (
     <ApolloProvider client={client}>
      <PaperProvider theme={primary}>
         <MyStack />
       </PaperProvider>
    </ApolloProvider>
  );
 }

lavanyasree-ch avatar Dec 29 '23 15:12 lavanyasree-ch

How to disable beep sounds?

debug: false

I have no idea what you're doing wrong, but you're doing something wrong.

See wiki "Debugging" and learn to observe the plug-in native logs.

christocracy avatar Dec 29 '23 15:12 christocracy

i check my code i din't understand where is wrong. BackgroundGeolocation is not working when terminate and reopen the app . please help me.

lavanyasree-ch avatar Jan 02 '24 13:01 lavanyasree-ch

See wiki "Debugging" and learn how to fetch logs from the plug-in database using .emailLog.

Also search api docs "Logger" for more information.

christocracy avatar Jan 02 '24 14:01 christocracy

This issue is stale because it has been open for 30 days with no activity.

github-actions[bot] avatar Apr 18 '24 01:04 github-actions[bot]

This issue was closed because it has been inactive for 14 days since being marked as stale.

github-actions[bot] avatar May 02 '24 01:05 github-actions[bot]