INNER CODE UNIT · Java

getCurrentPlace

tolu360/react-native-google-places · android/src/main/java/com/arttitude360/reactnative/rngoogleplaces/RNGooglePlacesModule.java:305

    public void getCurrentPlace(ReadableArray fields, final Promise promise) {
        if (ContextCompat.checkSelfPermission(this.reactContext.getApplicationContext(), permission.ACCESS_WIFI_STATE)
            != PackageManager.PERMISSION_GRANTED
        || ContextCompat.checkSelfPermission(this.reactContext.getApplicationContext(), permission.ACCESS_FINE_LOCATION)
            != PackageManager.PERMISSION_GRANTED) {        
            promise.reject("E_CURRENT_PLACE_ERROR", new Error("Both ACCESS_WIFI_STATE & ACCESS_FINE_LOCATION permissions are required"));
            return;
        }

        List<Place.Field> selectedFields = getPlaceFields(fields.toArrayList(), true);

        if (checkPermission(ACCESS_FINE_LOCATION)) {
            findCurrentPlaceWithPermissions(selectedFields, promise);
        }
    }

    /**
   * Fetches a list of {@link PlaceLikelihood} instances that represent the Places the user is

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…