GithubHelp home page GithubHelp logo

Comments (8)

romansky avatar romansky commented on July 17, 2024 1

Same here, RN 0.40, cant get it to work..

from react-native-location.

timfpark avatar timfpark commented on July 17, 2024

Which RN version are you using? I'm using it with react-native 0.27 and it works fine.

from react-native-location.

caledhwa avatar caledhwa commented on July 17, 2024

@joegaudet - I got this to work just fine with v0.28. I've submitted a PR to make installation easier using react-native link or rnpm link - this properly links your library. However, I found I needed to add

    <key>NSLocationWhenInUseUsageDescription</key>
    <string>This is the plist item for NSLocationWhenInUseUsageDescription</string>
    <key>NSLocationAlwaysUsageDescription</key>
    <string>This is the plist item for NSLocationAlwaysUsageDescription</string>

In order to get location data back. Other than that, the library seems to work great with v0.28 for me.

from react-native-location.

caledhwa avatar caledhwa commented on July 17, 2024

@joegaudet - Give the library a try with v0.28 by using the Example app added in PR #20 - once it's merged. Should work great [does for me].

from react-native-location.

JayChetty avatar JayChetty commented on July 17, 2024

Hi @joegaudet , I have same problem using react-native 0.40 + react-native-location 0.27. Did you find a solution?

from react-native-location.

Filipvdb321 avatar Filipvdb321 commented on July 17, 2024

Having the same problem with RN 0.41

from react-native-location.

romansky avatar romansky commented on July 17, 2024

I ended up using native google play code, pasting below for whoever is willing to adopt

public class MyLocation extends ReactContextBaseJavaModule {

    GoogleApiClient client = null;

    @ReactMethod
    public void getLocation(final Callback errorCallback, final Callback successCallback) {

        client = new GoogleApiClient.Builder(this.getCurrentActivity())
                .addConnectionCallbacks(new GoogleApiClient.ConnectionCallbacks() {
                    @Override
                    public void onConnected(@Nullable Bundle bundle) {
                        Location lastLocation = LocationServices.FusedLocationApi.getLastLocation(client);
                        successCallback.invoke(lastLocation.getLatitude(), lastLocation.getLongitude());
                    }
                    @Override
                    public void onConnectionSuspended(int i) {}
                })
                .addOnConnectionFailedListener(new GoogleApiClient.OnConnectionFailedListener() {
                    @Override
                    public void onConnectionFailed(@NonNull ConnectionResult connectionResult) {
                        errorCallback.invoke(connectionResult);
                    }
                })
                .addApi(LocationServices.API)
                .build();

        client.connect();

    }

    public MyLocation(ReactApplicationContext reactContext) {
        super(reactContext);
    }


    @Override
    public String getName() {
        return "MyLocation";
    }
}

from react-native-location.

matt-oakes avatar matt-oakes commented on July 17, 2024

Tracking in #35

from react-native-location.

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.