appoly/ARCore-Location

Set User Location Manually NOT Using GPS

ziadagh opened this issue · 2 comments

I am trying to set the user location manually, I am getting the location through BLE Beacons to get my location inside the building. (Indoor Location)
So I am eliminating the use of GPS for retrieving the location.

My question is, where can I set my location to the value I have?
What do I need to set? (X and Y coordinates or are there more values as well?)
Will the AR markers I have previously set be referenced to my location with its new coordinates? Or will it need more work to fix this?

I'm afraid you would have to fork the library and adapt it to your needs. We've fundamentally created this around Latitude & Longitude (and all the calculations surrounding that).

I found a bit of a workaround to this issue.
I'm listening on the locationScene.setOnLocationChangedEvent and when I get the new location I just override its existing values for longitude and latitude with the values I have, and then I render the markers using this updated locationScene where I have set the locationScene.deviceLocation.currentBestLocation to my value.

locationScene.setLocationChangedEvent(location -> {
    if(myLocation != null) {
        location.setLatitude(GeoDbSingleton.beaconLocation.getLatitude());
        location.setLongitude(GeoDbSingleton.beaconLocation.getLongitude());
        location.setAltitude(GeoDbSingleton.beaconLocation.getAltitude());
    }else{
        Toast("Cannot retrieve Indoor Location.");
    }

    if(locationScene.deviceLocation.currentBestLocation != null) {
        for (Marker marker : markers) {
            render(context, marker, locationScene);
        }
    }
});