Agontuk / react-native-geolocation-service

React native geolocation service for iOS and android
https://www.npmjs.com/package/react-native-geolocation-service
MIT License
1.6k stars 290 forks source link

gps location service is not working when app is in background state in android #391

Open lavanyasree-ch opened 1 year ago

lavanyasree-ch commented 1 year ago

Environment

Run npx react-native info in your terminal and copy the results here.

OS: macOS 13.0.1 CPU: (8) arm64 Apple M1 Memory: 81.39 MB / 16.00 GB Shell: 5.8.1 - /bin/zsh Binaries: Node: 18.0.0 - /opt/homebrew/bin/node Yarn: 1.22.18 - /opt/homebrew/bin/yarn npm: 8.19.2 - /opt/homebrew/bin/npm Watchman: 2022.03.21.00 - /opt/homebrew/bin/watchman Managers: CocoaPods: 1.11.3 - /opt/homebrew/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2021.1 AI-211.7628.21.2111.8193401 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.14.1 - /usr/bin/javac npmPackages: react: 17.0.2 => 17.0.2 react-native: 0.67.0 => 0.67.0

Platforms

Android

Versions

Please add the used versions/branches

Description

in android gps location service is not working when app goes into background state. but in foreground state it is working fine. and also it's working fine for ios in both background and foreground state.

asadmumtaz92 commented 1 year ago

@lavanyasree-ch I need help about this library, can you text me on linkedIn.

https://www.linkedin.com/in/asadmumtaz92

SurajMohanty02 commented 1 year ago

@lavanyasree-ch i'm also not getting the location when the app is in background in android. Any Solution?

ubaidjs commented 1 year ago

same. i am also unable to get location when minimising app

asadmumtaz92 commented 1 year ago

I hope you are fine.

Now I'am using thies following libraries:

  1. @react-native-get-location (for getting location)
  2. @supersami/rn-foreground-service (for background task)

On Wed, Jan 4, 2023 at 11:07 AM Suraj Mohanty @.***> wrote:

@lavanyasree-ch https://github.com/lavanyasree-ch i'm also not getting the location when the app is in background in android. Any Solution?

— Reply to this email directly, view it on GitHub https://github.com/Agontuk/react-native-geolocation-service/issues/391#issuecomment-1370522012, or unsubscribe https://github.com/notifications/unsubscribe-auth/AKSI6TO2H4IPN5KBAOUQ3IDWQUHTFANCNFSM6AAAAAATFOJKJI . You are receiving this because you commented.Message ID: @.*** com>

asadmumtaz92 commented 1 year ago

same. i am also unable to get location when minimising app

Now I'am using thies following libraries:

  1. @react-native-get-location (for getting location)
  2. @supersami/rn-foreground-service (for background task)
asadmumtaz92 commented 1 year ago

@lavanyasree-ch i'm also not getting the location when the app is in background in android. Any Solution?

Now I'am using thies following libraries:

  1. @react-native-get-location (for getting location)
  2. @supersami/rn-foreground-service (for background task)
lavanyasree-ch commented 1 year ago

Paid package is working in background getting location backgroun-geolocation but we have to call another package for running app in background I am using background-actions.

SurajMohanty02 commented 1 year ago

@lavanyasree-ch i'm also not getting the location when the app is in background in android. Any Solution?

Now I'am using thies following libraries:

  1. @react-native-get-location (for getting location)
  2. @supersami/rn-foreground-service (for background task)

Is it working in when mobile phone screen is locked / off?

lavanyasree-ch commented 1 year ago

There is one issue with background-actions after closing app also it's running in background. After uninstall app only It will stop doing in background.and it showing pop-up our app is accessing location like that

AlessandroSalvetti commented 1 year ago

@lavanyasree-ch i'm also not getting the location when the app is in background in android. Any Solution?

Now I'am using thies following libraries:

1. @react-native-get-location (for getting location)

2. @supersami/rn-foreground-service (for background task)

@asadmumtaz92 I have the same setup and the same error. Did you solve it?

AlessandroSalvetti commented 1 year ago

I solved it adding android:foregroundServiceType="location" to the supersami service tag into AndroidManifest.xml, like this:

<service android:name="com.supersami.foregroundservice.ForegroundService" android:foregroundServiceType="location"></service>
<service android:name="com.supersami.foregroundservice.ForegroundServiceTask" android:foregroundServiceType="location"></service>
NgVSang commented 9 months ago

I'm using react-native-background-timer for get location on background, It working good with IOS but Android seem not, any solution :<

SurajMohanty02 commented 7 months ago

@lavanyasree-ch How did you used both react native background action with paid geolocation package? Can you please tell me?