transistorsoft / react-native-background-geolocation

Sophisticated, battery-conscious background-geolocation with motion-detection
http://shop.transistorsoft.com/pages/react-native-background-geolocation
MIT License
2.63k stars 426 forks source link

service is not woking on some Android devices [Samsung] #1427

Closed hasan642 closed 2 years ago

hasan642 commented 2 years ago

Your Environment

/ eslint-disable no-return-assign /

import React, { createRef, memo } from 'react'; import BackgroundGeolocation, { Location as BGLocation, Geofence as BGGeofence, GeofenceEvent as BGGeofenceEvent, } from 'react-native-background-geolocation'; import { connect } from 'react-redux'; import { RootState } from 'reducers'; import { GeofencingHelper, openSettings, SentryHelper } from 'utils'; import { ModalizeRefType } from 'components'; import { TWorkBranch } from 'types/employee'; import { Alert, Platform } from 'react-native'; import RequestPermissionModal from './RequestPermissionModal'; import { enableLogger, createStartsSeperatorTemplate, debug } from './config';

// type checking. interface GeofencingProps { isAutoClockInOutEnabled: boolean; workBranches: TWorkBranch[]; isFetchingEmployeeDataDone: boolean; } interface GeofencingState { isServiceReady: boolean; isServiceEnabled: boolean; isServiceStarted: boolean; isPermissionsGranted: boolean; } export type GeofenceAction = 'ENTER' | 'EXIT' | 'DWELL';

/**

// constants. const logLevel = DEV ? BackgroundGeolocation.LOG_LEVEL_VERBOSE : BackgroundGeolocation.LOG_LEVEL_VERBOSE; const stopTimeout = 5;

// connect to redux. const mapStateToProps = ({ employee }: RootState) => { // constants. const isAutoClockInOutEnabled = employee.profile.employee?.auto_mobile_clock_in_out || false; const workBranches = employee.profile.employee?.work_locations || []; const isFetchingEmployeeDataDone = employee.loading === false && employee.profile.employee?.work_locations != null;

return { isAutoClockInOutEnabled, workBranches, isFetchingEmployeeDataDone }; };

// export geofencing as default. const areEqualProps = (prevProps: GeofencingProps, nextProps: GeofencingProps) => { // re-render only if is auto clock status on/off changed. return prevProps.isAutoClockInOutEnabled === nextProps.isAutoClockInOutEnabled; }; const memiozedGeofencing = memo(Geofencing, areEqualProps); export default connect(mapStateToProps)(memiozedGeofencing);


## Expected Behavior
should monitor and take the event when enter/exit the geofence (even when app is killed).

## Actual Behavior
service is not working when app is killed (even i followed the 'don't kill my app' guidelines).

## Steps to Reproduce
<!--- reproduce this issue; include code to reproduce, if relevant -->
1.
2.
3.
4.

## Context
<!--- What were you trying to do? -->

## Debug logs
<!-- include iOS / Android logs
- ios XCode logs,
- use #getLog #emailLog methods (@see docs)
- Android: $ adb logcat -s TSLocationManager
-->
<details><summary>Logs</summary>

``` <!-- Syntax highlighting:  DO NOT REMOVE -->
12-21 17:45:21.384 INFO [TSScheduleManager oneShot] 
  ⏰ Oneshot TERMINATE_EVENT is already pending
12-21 17:45:21.432 INFO [TSLogReader destroy] 
  ✅  Cleared log

christocracy commented 2 years ago

For device-specific issues, see http://dontkillmyapp.com

hasan642 commented 2 years ago

@christocracy I followed up the steps but not working, any another solution please? we need your help please!

christocracy commented 2 years ago

I suggest you clone the sample app and install on your device.

stale[bot] commented 2 years 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 2 years ago

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