IndoorAtlas / android-sdk-examples

Example applications for IndoorAtlas Android SDK
Apache License 2.0
94 stars 75 forks source link

Floor level is wrong in IALocation object even after hardcoding #51

Closed ritikrishu closed 6 years ago

ritikrishu commented 6 years ago

I am hard coding the floor plan in IALocation object, it should be floor level 3 but it is always showing 0. this is the snnipet-

            mIALocationManager = IALocationManager.create(mContext);
            mIALocationManager.requestLocationUpdates(IALocationRequest.create(), this);
            mIALocationManager.registerRegionListener(this);
            mCurrentFloorPlan =  IARegion.floorPlan("<floor plan id>");
            mIALocationManager.setLocation(IALocation.from(mCurrentFloorPlan));
            Location targetLocation = new Location("");//provider name is unnecessary
            targetLocation.setLatitude(buildingLat);//your coords of course
            targetLocation.setLongitude(buildingLng);
            mIaLocation = IALocation.from(targetLocation);
jraanamo commented 6 years ago

So you are setting the floor plan explicitly because you somehow know that the user must always be in floor level 3? I don't quite understand from this code where/when is it that IndoorAtlas system returns floor level 0 when you expect 3?

ritikrishu commented 6 years ago

mIaLocation.getFloorLevel() was returning zero. We deleted the building from the dashboard and reconfigured. This issue is not coming anymore.

ritikrishu commented 6 years ago

@jraanamo not related to this issue, but can you tell me how to configure location scan intervals? For example: I set the location request at 10 sec fastest interval and high priority, still getting location updates at ~90 sec intervals. here is how my code looks-

IALocationRequest request = IALocationRequest.create()
                    .setFastestInterval(10000)
                    .setPriority(IALocationRequest.PRIORITY_HIGH_ACCURACY);
            mIALocationManager.requestLocationUpdates(request, this);
            mIALocationManager.registerRegionListener(this);
jraanamo commented 6 years ago

Once per 90 seconds is a really slow frequency. Is your use case a foreground use case? Without setting any frequency you should expect to get update around 1-2 per second - that is, assuming your are walking.

ritikrishu commented 6 years ago

Yes, we are running a Foreground Service but it's other than the service implementing IALocationListener. We want to get location callbacks max at every thirty seconds regardless user activity is still or walking. Do we need the service that implementing IALocationListener to run on the foreground? How do we get guaranteed 30 sec locations for any device state?

jraanamo commented 6 years ago

If the operating system considers your application process a "foreground process" due to the fact that you have another service promoted to a foreground process, then it should not matter which service listens to location updates. However, I'd start from a very simple version where it's an Activity that listens to location updates, check that everything works as expected and only then move to more complex architecture. Note that if you keep the device very very still (e.g. on the table), then IndoorAtlas will assume user is not moving and hence will also do no processing and emit no location updates. It should not be a problem to guarantee that you'll receive location updates at regular intervals when the application is on the foreground and the user is moving. But if the app goes to background (e.g. screen off), then the situation is more complicated and you need to resort to general Android forums to seek help for running your processes in the background.

On Sun, May 13, 2018 at 12:59 AM, Ritik Rishu notifications@github.com wrote:

Yes, we are running a Foreground Service but it's other than the service implementing IALocationListener. We want to get location callbacks max at every thirty seconds regardless user activity is still or walking. Do we need the service that implementing IALocationListener to run on the foreground? How do we get guaranteed 30 sec locations for any device state?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IndoorAtlas/android-sdk-examples/issues/51#issuecomment-388586193, or mute the thread https://github.com/notifications/unsubscribe-auth/AAmjw6zr-Y2dC0-9EWUjLtYPnBbaVzibks5tx1tJgaJpZM4TzLXp .

-- Jukka Raanamo jukka.raanamo@gmail.com http://fi.linkedin.com/in/jukkaraanamo http://www.kinetik.fi/

ritikrishu commented 6 years ago

My foreground service(that keeps running even after app is closed) collects GPS locations and indoors locations indefinitely(in their own child services) until stopped explicitly. We are getting GPS locations continuously for hours, even if the device is kept still on a table. We need location per 30 sec, which GPS is giving but IndoorAtlas, however, gives location on larger delays. When I walk around with the device in my hand, IndoorAtlas works as expected. Also, the location callback frequency resumes to normal if I again pick the phone up and start walking. The service implementation part looks quite right to me. I just wanted to know possibilities if Indoors will continue giving regular updates given the device is in absolute still position and screen locked for hours.