surialabs / react-native-geo-fencing

Native modules to determine if a location is within defined geographical boundaries using Google Geometry library
139 stars 33 forks source link

related to the latest update of Google Play Services 12.0.0 #10

Closed Kotdnz closed 6 years ago

Kotdnz commented 6 years ago

android/settings.grandle include ':react-native-camera' project(':react-native-camera').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-camera/android') include ':react-native-fused-location' project(':react-native-fused-location').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fused-location/android') include ':react-native-geo-fencing' project(':react-native-geo-fencing').projectDir = new File(settingsDir, '../node_modules/react-native-geo-fencing/android') include ':app'

android/app/build.grandle dependencies { compile project(':react-native-camera') compile fileTree(dir: "libs", include: ["*.jar"]) compile "com.android.support:appcompat-v7:23.0.1" compile "com.facebook.react:react-native:+" // From node_modules compile project(':react-native-fused-location') compile project(':react-native-geo-fencing') compile (project(':react-native-camera')) { exclude group: "com.google.android.gms" compile 'com.android.support:exifinterface:27.+' } compile ("com.google.android.gms:play-services-gcm:11.8.0") { force = true; } }

Totally broken....

` const polygon = [ { lat: 3.1336599385978805, lng: 101.31866455078125 }, { lat: 3.3091633559540123, lng: 101.66198730468757 }, { lat: 3.091150714460597, lng: 101.92977905273438 }, { lat: 3.1336599385978805, lng: 101.31866455078125 } // last point has to be same as first point ];

let point = { lat: 2.951269758090068, lng: 101.964111328125 };

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

example compiled Ok, but with next crash

`Could not invoke SLRNGeoFencing.containsLocation

null

com.google.android.gms.maps.model.LatLng invoke JavaMethodWrapper.java:385 invoke JavaModuleWrapper.java:162 run NativeRunnable.java handleCallback Handler.java:739 dispatchMessage Handler.java:95 dispatchMessage MessageQueueThreadHandler.java:31 loop Looper.java:148 run MessageQueueThreadImpl.java:194 run Thread.java:818 `

Kotdnz commented 6 years ago

With the next build.gradle all working fine.

apply plugin: 'com.android.library'

android {
    compileSdkVersion 23
    buildToolsVersion "23.0.1"

    defaultConfig {
        minSdkVersion 16
        targetSdkVersion 23
        versionCode 1
        versionName "1.0"
    }
}

dependencies {
    compile 'com.facebook.react:react-native:0.19.+'
    compile 'com.google.android.gms:play-services-base:11.6.0'  
    compile 'com.google.android.gms:play-services-maps:11.6.0'
    compile 'com.google.maps.android:android-maps-utils:0.4'
}