GithubHelp home page GithubHelp logo

Comments (26)

matt-oakes avatar matt-oakes commented on June 30, 2024 32

This is defiantly a good idea, however, I think we should still allow developers to use the current android.location API if they want as there are some good reasons to use it:

  • Not all devices have Google Play, especially in China where none do.
  • Not all devices have up-to-date versions of Google Play and users who are signed in to enable the API. I'm not sure if location is affected by this, but it can be a problem for some Google Play Services APIs.

We might also need to alter the API to properly support this and other settings.

from react-native-geolocation.

Return-1 avatar Return-1 commented on June 30, 2024 25

Just out of curiosity, are there still plans to maintain this lib?

from react-native-geolocation.

vinithreddy3 avatar vinithreddy3 commented on June 30, 2024 20

Any updates whether this package is planning to implement location updates using play services api ? Looking into the discussion 'react-native-geolocation-service' package for android is using FusedLocationProviderClient's requestLocationUpdates task with a callback for which official doc says 'This method is suited for the foreground use cases' . So any plan for implementing background location updates with this package ?

from react-native-geolocation.

matt-oakes avatar matt-oakes commented on June 30, 2024 17

I think the default should be "auto". It should try to use the Google Play one, but if one of these conditions is not met, it would automatically fallback to the android.location API:

  • App does not have the Google Play Services dependencies linked.
  • Device does not have Google Play services installed.
  • Google Play Services responds with a non-resolvable error (see here for how error handling works).

That should "do the right thing" with no configuration for most users and avoid the need for users to understand the differences and handle checking for the presence of Google Play Services themselves.

from react-native-geolocation.

scousino avatar scousino commented on June 30, 2024 15

Just want to hop in here and see if there has been any updates on this issue?

from react-native-geolocation.

huszzsolt avatar huszzsolt commented on June 30, 2024 3

I've just seen react-native-geolocation-service is now using react-native-geolocation
https://github.com/Agontuk/react-native-geolocation-service/blob/master/CHANGELOG.md
which is not great, i feel

from react-native-geolocation.

giacomocerquone avatar giacomocerquone commented on June 30, 2024 3

@ravirajn22

I have a good background on geolocation features in react native.
I'd say to use as a guideline this package here: https://github.com/transistorsoft/react-native-background-geolocation
It's a fantastic lib that should be taken as inspiration when working on this.
Let's go for points:

  1. For this I wouldn't expose too much. As I have just said, getting inspiration from that package, I'd expose just a "requestPermission" function to request geolocation permission, but it should never be called manually by the developer since the module should request it automatically. And just for info, you shouldn't create a structure as the one created by react-native-permissions and you shouldn't import that too.
  2. This is a very important decision. That same module I talked before, it's very complex and allows you to track an user in various way, in background (and in killed state too) both on iOS and Android.
    If you ask me, I'd say to absolutely avoid any kind of background implementation and give to the user just the possibility to track a device getting a position once or doing a "watchPosition" as long as the app is running in foreground.
  3. yes sure, but I'd not publish without testing it.

from react-native-geolocation.

ravirajn22 avatar ravirajn22 commented on June 30, 2024 3

Hi, I went through other geolocation libraries and feel react-native-geolocation-service seems to have a stable code and almost supports web API spec and react-native-location has implemented a way of using both google play services and android location api but does not match web API spec . I feel better copy android code from react-native-geolocation-service and add a way to use android.location API for non google services devices like they have done it in react-native-location. So that we can keep the current API as it is without making any breaking changes? This requires copying code from other libraries instead of reimplementing here again. What do you say folks, is this approach ok?

from react-native-geolocation.

dulmandakh avatar dulmandakh commented on June 30, 2024 1

how is it easy to support multiple backends, like plain android and google play services?

from react-native-geolocation.

dohard-ma avatar dohard-ma commented on June 30, 2024 1

expect

from react-native-geolocation.

matt-oakes avatar matt-oakes commented on June 30, 2024 1

@nicklockwood No, there are no updates. Contributions are always welcome though.

from react-native-geolocation.

giacomocerquone avatar giacomocerquone commented on June 30, 2024 1

why not to try to ask to one of the developers of those modules to join this repo and put here their code in order to help them too maintaining their libs?
I know it may be problematic for a lot of reasons but something must be done on trying to avoid to waste more time on writing implementations of things that we already have out in the public.

Do you have any ideas that would let us write less code to implement this feature (that I find really of core importance)?

from react-native-geolocation.

matt-oakes avatar matt-oakes commented on June 30, 2024

I have implemented it in react-native-location by having an abstract interface which each provider can implement and then implementing it for each provider:

There is then a piece of code which selects which one to use based on the app dependencies and the configuration setting which the user has requested.

I've not really dug too much into this libraries code yet, but we can likely use a similar method.

from react-native-geolocation.

tijs avatar tijs commented on June 30, 2024

Isn’t fused location the preferred way to get location on android these days. As implemented by https://github.com/MustansirZia/react-native-fused-location for instance...

from react-native-geolocation.

matt-oakes avatar matt-oakes commented on June 30, 2024

@tijs It is, and that's why this library should support it, however, as noted above it's not always available on all devices so we need to support both.

from react-native-geolocation.

tijs avatar tijs commented on June 30, 2024

Right that seems like a sensible path. So the main package would provide a stable API while the actual location service is provided by a 'plugin' or 'driver', with some defaults out of the box. I've found the way they did this in the LocalForage package very practical. Actually makes it quite easy to provide a custom driver as well. Maybe interesting inspiration? https://localforage.github.io/localForage/#settings-api-setdriver

from react-native-geolocation.

matt-oakes avatar matt-oakes commented on June 30, 2024

Exactly. We need to discuss how this will work exactly, but I think that we will try to use the best API possible by default and let the developer override that if they know they want to use a specific one.

Thanks for the link to LocalForge πŸ‘

from react-native-geolocation.

michalchudziak avatar michalchudziak commented on June 30, 2024

@matt-oakes @tijs I love the ideas of a native interface to be implemented by different providers as well as the driver system. I wonder if we should enforce users to pick one of the available services via setDriver method, or would we have a default one and make it options if someone wants to use a different service? If we'll have a default one - which one it should be?

from react-native-geolocation.

nicomontanari avatar nicomontanari commented on June 30, 2024

Hi! Are there any updates?

from react-native-geolocation.

dulmandakh avatar dulmandakh commented on June 30, 2024

let's make it work for most cases, or use Google Services. Maybe add other backends later on.

from react-native-geolocation.

vomchik avatar vomchik commented on June 30, 2024

I've just seen react-native-geolocation-service is now using react-native-geolocation
https://github.com/Agontuk/react-native-geolocation-service/blob/master/CHANGELOG.md
which is not great, i feel

This is for iOS only.

from react-native-geolocation.

ravirajn22 avatar ravirajn22 commented on June 30, 2024

I will try to work on this change, @matt-oakes @dulmandakh @michalchudziak any suggestion and ideas related to the API.
Need help and suggestions regarding

  1. Permission handling.
  2. Should we explicitly inform the users that the geolocation updates when in background is not possible using javascript? or is it possible?
  3. Testing? Can we skip automated tests for now and later we can add it.

Is some other team or person working on this change already?

from react-native-geolocation.

vorasudh avatar vorasudh commented on June 30, 2024

@ravirajn22, were you able to work on the changes?

from react-native-geolocation.

hondem avatar hondem commented on June 30, 2024

Hello guys. Were there any updates on this topic recently?

from react-native-geolocation.

ravirajn22 avatar ravirajn22 commented on June 30, 2024

Moved to https://github.com/Agontuk/react-native-geolocation-service long back. Very stable.

from react-native-geolocation.

AlgorithmeCM avatar AlgorithmeCM commented on June 30, 2024

Moved to https://github.com/Agontuk/react-native-geolocation-service long back. Very stable.

I'm stuck on the geolocation access authorization problem on Android with this library.
Can you share how you were able to deal with this problem?

from react-native-geolocation.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.