Giter Club home page Giter Club logo

Comments (13)

oakis avatar oakis commented on May 27, 2024 1

@rayj10 Yes i use react-native-firebase, but not with messaging yet. This is part of my build.gradle:

implementation "com.google.android.gms:play-services-base:12.0.1"
implementation "com.google.firebase:firebase-core:12.0.1"
implementation "com.google.firebase:firebase-auth:12.0.1"
implementation "com.google.firebase:firebase-database:12.0.1"
implementation 'com.google.android.gms:play-services-location:12.0.1'

from react-native-geolocation-service.

Agontuk avatar Agontuk commented on May 27, 2024 1

No, I meant emulator will not give you the actual location. It'll always return the same position that you entered. If you want to test your actual current position, you're gonna need a real device.

from react-native-geolocation-service.

Agontuk avatar Agontuk commented on May 27, 2024

You have to use same version for each of those libraries. Try using 12.0.1 for all of them, 15+ probably won't work if gradle tools version is lower than 3.3 I think.

from react-native-geolocation-service.

rayj10 avatar rayj10 commented on May 27, 2024

Thanks for the prompt reply! and I tried just deleting the apply plugin part, it got ur lib to work but not sure if it affects the firebase. The thing is firebase specifically ask for 15.0.1 but in some forum it has been known that the apply plugin line could cause problems. I just have to test it first if both ur lib and firebase could work using the current setup properly. If not I'll try ur solution using 12.0.1 and report back.

Thanks for the lib! It really solved the problem with RN's geoloc and saved me lots of time 😄

from react-native-geolocation-service.

oakis avatar oakis commented on May 27, 2024

I use 12.0.1 for all libs and that works for me.

from react-native-geolocation-service.

nickarora avatar nickarora commented on May 27, 2024

You can continue to use 15.0.1 along with react-native-firebase; just make sure you configure your project-wide gradle configuration properties and update app/build.gradle appropriately.

ex:

/**
 + Project-wide Gradle configuration properties
 */
ext {
    compileSdkVersion   = 25
    targetSdkVersion    = 25
    buildToolsVersion   = "25.0.2"
    supportLibVersion   = "25.0.1"
    googlePlayServicesVersion = "15.0.1"
}

from react-native-geolocation-service.

rayj10 avatar rayj10 commented on May 27, 2024

@oakis U mean it works for both this lib and firebase messaging like the one I'm trying to use?
Because I'm aware that this lib can work with anything 11+ but the problem is if the firebase part of my code will since they don't really mention it in the docs

@nickarora sounds good I will try adding that partto my project level gradle. I tried adding ext {} yesterday but it gave me error, I think my problem is I'm not sure what to look for in my app level gradle to "update properly" as u mentioned. Sorry I'm pretty new to this, this is the first project that I have to do these stuff manually for RN. 😅

Thanks for the pointers everyone! 😄

from react-native-geolocation-service.

rayj10 avatar rayj10 commented on May 27, 2024

@oakis cool, I'll try that out then, seems like thats gotta be the optimum solve. Thanks heaps! 😄

from react-native-geolocation-service.

rayj10 avatar rayj10 commented on May 27, 2024

So I tried writing my app and project level gradle like the following (based on everyone's recommendations combined):

app level

dependencies {
//RNGeolocServices
implementation "com.google.android.gms:play-services-location:$rootProject.googlePlayServicesVersion"
implementation project(':react-native-geolocation-service')
//firebase
implementation "com.google.android.gms:play-services-base:$rootProject.googlePlayServicesVersion"
implementation "com.google.firebase:firebase-core:16.0.1"
implementation "com.google.firebase:firebase-messaging:17.1.0"
implementation 'me.leolin:ShortcutBadger:1.1.21@aar'

project level

ext {
    compileSdkVersion   = 27
    targetSdkVersion    = 27
    buildToolsVersion   = "27.0.3"
    googlePlayServicesVersion = "15.0.1"
}

It solved the original error but giving me this error upon accessing device location:

{message: "Google play service is not available.", code: 4}

UPDATE:
I updated my emulator to API24 so it has google play store by default and can update google play services automatically and it solved the above error. But now I'm getting this instead:
{message: "Location request timed out.", code: 3}
`
Any suggestion what I should try next?
thanks in advance guys for the help and patience with my lack of experience 😅

from react-native-geolocation-service.

Agontuk avatar Agontuk commented on May 27, 2024

You have to turn on GPS in your emulator, although testing on emulator won't do you any good since it'll give you a mock location. You have to test on a real device.

from react-native-geolocation-service.

oakis avatar oakis commented on May 27, 2024

You can use the emulator as well, just put in coordinates manually and press send. Then test your app and it should receive the location.

from react-native-geolocation-service.

rayj10 avatar rayj10 commented on May 27, 2024

@Agontuk So the one returned on emulator will always be mock regardless of the "allow mock" toggle on the settings?
I assume the mock property returned by getCurrentPosition() is just checking whether or not allow mock setting is turned on then?

@oakis I'm receiving the location just fine after I fixed the above problem, the problem was apparently I need to put the third argument for the getCurrentPosition() that has these { enableHighAccuracy: true, timeout: 2000, maximumAge: 3600000 }. Not sure if the success is dependent on enableHighAccuracy being true as some other forum posts said...

Thanks for the amazing support and prompt replies guys! 😄

from react-native-geolocation-service.

rayj10 avatar rayj10 commented on May 27, 2024

@Agontuk Thanks for the prompt replies and guidance! 😄 closing this now..

from react-native-geolocation-service.

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.