transistorsoft / cordova-background-geolocation-lt

The most sophisticated background location-tracking & geofencing module with battery-conscious motion-detection intelligence for iOS and Android.
http://www.transistorsoft.com/shop/products/cordova-background-geolocation
Other
655 stars 277 forks source link

Testing several phones, plugin not showing consistent speed, heading on one #1336

Open TARJr opened 2 years ago

TARJr commented 2 years ago

Your Environment

@Injectable() export class BackgroundGeolocationProvider { constructor( private utilsProvider: UtilsService, private platform: Platform, private toastCtrl: ToastController ) {

        if(!BackgroundGeolocation) return;

        BackgroundGeolocation.ready({
            reset: true,
            debug: false,
            locationAuthorizationRequest: 'Always',
            backgroundPermissionRationale: {
                title: "Allow access to this device's location in the background?",
                message: "Please enable 'Allow all the time permission",
                positiveAction: "Change to Allow all the time"
            },
            /* iOS only */
            locationAuthorizationAlert: {
                titleWhenNotEnabled: "Yo, location-services not enabled",
                titleWhenOff: "Yo, location-services OFF",
                instructions: "You must enable 'Always' in location-services, buddy",
                cancelButton: "Cancel",
                settingsButton: "Settings"
            },
            stationaryRadius: 50,
            /* **** */
            logLevel: BackgroundGeolocation.LOG_LEVEL_VERBOSE,
            desiredAccuracy: BackgroundGeolocation.DESIRED_ACCURACY_HIGH,
            distanceFilter: this.platform.is('ios') ? 300 : 0,
            /* android only */
            foregroundService: true,
            locationUpdateInterval: 2 * 60000,
            fastestLocationUpdateInterval: 2 * 60000,
            allowIdenticalLocations: false,
            /* **** */
            stopOnTerminate: false,
            startOnBoot: true,
            url: `${API_INFO.DEVICE_API}/v1/devices/${mac.substr(6)}/tracks`,
            method: 'PUT',
            autoSync: true,
            httpRootProperty: 'PHS_LOCATION'
        });
    });
}

start() {
    BackgroundGeolocation.getState((state) => {
        console.log(`BackgroundGeolocationProvider::start: enabled?`, state.enabled);

        !state.enabled && BackgroundGeolocation.start(() => {
            console.log(`BackgroundGeolocationProvider::start: OK`);
        }, (err) => {
            console.log(`BackgroundGeolocationProvider::start: error`, err);
        });
    });
}

stop() {
    BackgroundGeolocation.getState((state) => {
        console.log(`BackgroundGeolocationProvider::stop: enabled?`, state.enabled);

        state.enabled && BackgroundGeolocation.stop(() => {
            console.log(`BackgroundGeolocationProvider::stop: OK`);
        }, (err) => {
            console.log(`BackgroundGeolocationProvider::stop: error`, err);
        });
    });
}

}


## Expected Behavior
<!--- Tell us what should happen -->
Should get speed, heading and accurate lat/lon.
## Actual Behavior
<!--- Tell us what happens instead -->
No speed or heading and lat/lon way off, only once in a while shows correct readings.
## Steps to Reproduce
<!--- reproduce this issue; include code to reproduce, if relevant -->
1. install my app
2. drive around, no speed or heading
3. install gpswox and my app works as expected...
4. (other phones working as expected)

## Context
<!--- What were you trying to do? -->
Phone does not get a good fix while driving around. Rarely shows speed and heading and lat.lon off by too much.

However, when I installed the gpswox app and enabled tracking, our app tracked as expected.
Uninstalled gpswox app and back to not working.
Something in that app is putting the phone's gps in the right mood.

Is there anything that I can adjust to make it more aggressive, wait for a better fix, more samples, etc?
## Debug logs
<!-- include iOS / Android logs
- ios XCode logs,
- use #getLog #emailLog methods (@see docs)
- Android: $ adb logcat
-->
<details>
    <summary>Logs</summary>

```<!-- Syntax highlighting:  DO NOT REMOVE -->
PASTE_YOUR_LOGS_HERE

christocracy commented 2 years ago

get rid of these:

locationUpdateInterval: 2 60000, fastestLocationUpdateInterval: 2 60000,

stale[bot] commented 1 year ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and I will leave this open.

stale[bot] commented 1 year ago

Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you.

github-actions[bot] commented 11 hours ago

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