Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android issue with React Native 0.53 #8

Open
imjaadH opened this issue Mar 10, 2018 · 15 comments
Open

Android issue with React Native 0.53 #8

imjaadH opened this issue Mar 10, 2018 · 15 comments

Comments

@imjaadH
Copy link

imjaadH commented Mar 10, 2018

On ios everything works fine but i got an error on android app.
This is more like a tip for those who are starting out with newer react native version. If you get this error
com.google.android.gms.maps.model null
Just add this inside your build.gradle file and recompile
compile "com.google.android.gms:play-services-maps:11.6.0"

@ydv0121
Copy link

ydv0121 commented Mar 10, 2018

in ios not working for me...please help

const polygon = [
{"lat": 37.42380853737998,"lng": -122.08662271499634},
{"lat": 37.42352949259187,"lng": -122.08644200116395},
{"lat": 37.42384474922283,"lng": -122.08275865763426},
{"lat": 37.42008900856639,"lng": -122.08249680697918},
{"lat": 37.42134369453038,"lng": -122.08579190075396},
// last point has to be same as first point
];

let point = {
  "lat": 37.421998333333335,
  "lng": -122.08400000000002
};

GeoFencing.containsLocation(point, polygon)
  .then(() => console.log('point is within polygon'))
  .catch(() => console.log('point is NOT within polygon'))

my coordinates is inside of polygon
always describe "point is not within polygon" in IOS only

in android its working fine. also with realtime coordinates

@imjaadH
Copy link
Author

imjaadH commented Mar 26, 2018

Hi sorry for the late reply
thats strange, i was using ios simulator and with custom location it was working fine afaik, are you testing on a device or simulator

@ydv0121
Copy link

ydv0121 commented Mar 27, 2018

yes i am testing on simulator.
and custom location not working..

**see this is my custom location.
const polygon = [
{"lat": 37.42380853737998,"lng": -122.08662271499634},
{"lat": 37.42352949259187,"lng": -122.08644200116395},
{"lat": 37.42384474922283,"lng": -122.08275865763426},
{"lat": 37.42008900856639,"lng": -122.08249680697918},
{"lat": 37.42134369453038,"lng": -122.08579190075396},
// last point has to be same as first point
];

let point = {
"lat": 37.421998333333335,
"lng": -122.08400000000002
};

GeoFencing.containsLocation(point, polygon)
.then(() => console.log('point is within polygon'))
.catch(() => console.log('point is NOT within polygon'))**

it always display POINT IS NOT WITHIN POLYGON

is there any particular installation procedure for ios ?

@imjaadH
Copy link
Author

imjaadH commented Mar 27, 2018

Not particular, you have to just link the libraries and install in podfile thats it. If its not propperly installed it would have given error already. So i guess something is really wrong with library. I spend half of the day on android real device..zero success untill i kinda realized this thing is not useful for physical devices & ended up doing something else :(

@ydv0121
Copy link

ydv0121 commented Mar 28, 2018

in android for me its working with live location..
can you send me your ios codes if possible?

@imjaadH
Copy link
Author

imjaadH commented Mar 29, 2018

Try on ios simulator one more time, if it works then we can conclude that it works on simulators and not real devices, let me know i ll share the code although its just like the one in docs nothing fancy...

@hasan642
Copy link

@ydv0121 can you help me plz !!!

@ydv0121
Copy link

ydv0121 commented Nov 22, 2018

@hasanal1995 about what?

@hasan642
Copy link

it is not working only if lat and lng fully matching, can i set radius ?

@ydv0121
Copy link

ydv0121 commented Nov 22, 2018

i don't know about it when lat lng fully matching

@hasan642
Copy link

i mean it is not working only if point equals one of geofences.
example:
import React from 'react';
import GeoFencing from 'react-native-geo-fencing';
//__________________________________________
export default class extends React.Component {
componentDidMount() {
const polygon = [
{ lat: 32.0176763, lng: 36.0081422 },
];

    navigator.geolocation.getCurrentPosition(
        (position) => {
            console.log('positio is', position)
            let point = {
                lat: position.coords.latitude,
                lng: position.coords.longitude
            };

            GeoFencing.containsLocation(point, polygon)
                .then(() => console.log('point is within polygon'))
                .catch(() => console.log('point is NOT within polygon'))
        },
        (error) => alert(error.message),
        { enableHighAccuracy: false, timeout: 20000, maximumAge: 1000 }
    );
}

render() { return null; }

}

// if point equal { lat: 32.0176763, lng: 36.0081422 } "point is within polygon", else if is not equal exactly "point is NOT within polygon".

are you understand me bro ?

@ydv0121
Copy link

ydv0121 commented Nov 23, 2018

yes understood but looks like you are matching with only one lat-lng with your current location...in polygon/radius there are starting and ending points ..

your polygon must have starting and ending points like this

screenshot_1542946700 png

const polygon = [
{"lat": 37.42380853737998,"lng": -122.08662271499634},
{"lat": 37.42352949259187,"lng": -122.08644200116395},
{"lat": 37.42384474922283,"lng": -122.08275865763426},
{"lat": 37.42008900856639,"lng": -122.08249680697918},
{"lat": 37.42134369453038,"lng": -122.08579190075396},
// last point has to be same as first point
];

@hasan642
Copy link

You mean first coordinates must be as last coordinates? And coordinates between them can be different ??

@JefriBulo
Copy link

Hello Friend
I want to ask something about this geofencing

My lat long coordinates is inside the "const polygon" but still show "point is NOT within polygon" or "you are outside of polygon". I'm using my android real device for this project. Can you help me about this problem? thanks in advance

@JefriBulo
Copy link

I'm currently using react-native-cli: 2.0.1 and react-native: 0.57.1 version. Any solutions? Thanks friends

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants