transistorsoft / transistorsoft/react-native-background-geolocation

service starting on app startup

Open
#1,231 34 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
2.9k
Forks
446
PR merge metrics
No merged PRs in 30d

Description

Your Environment

  • Plugin version: 3.9.3
  • Platform: Both
  • OS version:
  • Device manufacturer / model: iPhone8, Samsung S10
  • React Native version (react-native -v): 0.63.3
  • Plugin config
    BackgroundGeolocation.onLocation(onLocation, onError);
    BackgroundGeolocation.onMotionChange(onMotionChange);
    BackgroundGeolocation.onActivityChange(onActivityChange);
    BackgroundGeolocation.onProviderChange(onProviderChange);
    BackgroundGeolocation.ready({
        // Geolocation Config
        desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
        distanceFilter: 10,
        // Activity Recognition
        stopTimeout: 1,
        // 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: false,        // <-- Auto start tracking when device is powered-up.
        // HTTP / SQLite config
        url: 'http://yourserver.com/locations',
        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.
        headers: {              // <-- Optional HTTP headers
            'X-FOO': 'bar'
        },
        params: {               // <-- Optional HTTP params
            'auth_token': 'maybe_your_server_authenticates_via_token_YES?'
        }
    }, (state) => {
        console.log('- BackgroundGeolocation is configured and ready: ', state.enabled);
        // if (!state.enabled) {
        //     BackgroundGeolocation.start(function () {
        //         console.log('- Start success');
        //     });
        // }
    });

Expected Behavior

Service should not automatically start on app init/startup

Actual Behavior

App does start, even if startOnBoot: false and I comment out the success Background

Steps to Reproduce

Context

Debug logs

Logs
PASTE_YOUR_LOGS_HERE

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the shown BackgroundGeolocation.ready configuration and reproduce the startup behavior on iOS and Android. Capture the platform logs requested in the issue and compare service state before and after ready. Done means the service remains stopped at app startup when startOnBoot is false and no explicit start is called.

Written by the indexing model from the issue text.

Assessment

Tech stack
react-native, typescript
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.