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

The config doesn't effect on the release mode

Open socheatleang opened this issue 2 years ago • 2 comments

Your Environment

  • Plugin version: 4.12.1
  • Platform: Android
  • OS version: All OS version
  • Device manufacturer / model: Android model
  • React Native version (react-native -v): 0.69.9
  • Plugin config
   await BackgroundGeolocation.ready({
      desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
      distanceFilter: 10,
      stopTimeout: 2,
      debug: false,
      logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
      stopOnTerminate: true,
      startOnBoot: true,
      batchSync: false,
      autoSync: false,
      locationAuthorizationRequest: 'WhenInUse',
      backgroundPermissionRationale: {
        title:
          "Allow the DEFIT App to access to this device's location in the background?",
        message:
          'In order to track your activity in the background, please enable "Allow all the time" location permission',
        positiveAction: 'Change to "Allow all the time"',
        negativeAction: 'Cancel',
      },
    }).catch((error) => {
      console.log({
        error,
    });
 });

Expected Behavior

The release mode must work the same of debug mode.

Actual Behavior

I have build and test with expo --dev-client version, It works as expected. However when I built release mode and upload to the google playstore in order to publish for internal testing. It won't work as expected.

It seems like the ready function above doesn't work properly. We able to let our user allow permission from WhenInUse app, but the app always asks for All all the time with the default message popup (see the attachment). https://app.screencast.com/2QhDb1WAVrVX7 .

Steps to Reproduce

  1. Expo build for .aab
  2. Upload to playstore with internal testing
  3. Download to physical device and open app to have a try

Context

  • I have double check the code and licence key.
  • I have tried to build by clean the cache during the build.
  • I have tried with different android phone

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

socheatleang avatar Jul 14 '23 06:07 socheatleang

You are likely calling .getCurrentPosition or .start() before you call .ready(config).

Your Config is not provided to the plugin until .ready(config) resolves.

For example, you will experience your problem if you did something like this:

BackgroundGeolocation.getCurrentPosition();
.
.
.
BackgroundGeolocation.ready(config);

christocracy avatar Jul 14 '23 12:07 christocracy

Thanks for your respond.

We trigger the .ready(config) one time when the app start. We are using the async-wait. So we are sure that we trigger .ready(config) before .start().

It's also working fine on staging(release & debug).

socheatleang avatar Jul 14 '23 15:07 socheatleang

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

github-actions[bot] avatar May 14 '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 May 28 '24 01:05 github-actions[bot]