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

expo not works when the application is terminated

Open uriiz opened this issue 2 years ago • 2 comments

My Environment

  • Plugin version: 4.11.3
  • Platform: Android
  • OS version:Android
  • Device manufacturer / model: google pixel 6
  • React Native version (react-native -v): expo 48
  • Plugin config
 useEffect(() => {


    BackgroundGeolocation.ready({
      heartbeatInterval: 60,
      debug: true,
      stopOnTerminate: false,   // <-- Allow the background-service to continue tracking when app terminated.
      startOnBoot: true, 
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      notification: {
        title: "The Notification Title",
        text: "The Notification Text",
      },
      preventSuspend: true // <-- Required for iOS
    });
    
    const subscription = BackgroundGeolocation.onHeartbeat((event) => {
      console.log("[onHeartbeat] ", event);
      getLocationF()
      // You could request a new location if you wish.
      BackgroundGeolocation.getCurrentPosition({
        samples: 1,
        persist: true
      }).then((location) => {
        console.log("[getCurrentPosition] ", location);
      });
    })
  }, []);

  const getLocationF = async () => {
    await Notifications.scheduleNotificationAsync({
      content: {
        title: "You've got mail! 📬",
        body: 'Here is the notification body',
        data: { data: 'goes here' },
      },
      trigger: { seconds: 2 },
    });
  }

Expected Behavior

Need To send me notification every minute when the app is killed.

Actual Behavior

Send me notification every minute but only when the app is on background or forground

Steps to Reproduce

  1. eas build --profile development
  2. install the apk on my device (google pixel)
  3. define battery to be unrestricted
  4. npx expo start --dev-client

Context

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

uriiz avatar Apr 24 '23 07:04 uriiz

Are you observing the plug-in logs in $ adb logcat? See wiki “Debugging”.

also see api docs Config.enableHeadless

christocracy avatar Apr 24 '23 12:04 christocracy

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

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

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

github-actions[bot] avatar Jun 04 '24 01:06 github-actions[bot]