Note that there are several complete examples which download and show the floor plan image in the IndoorAtlas Android Examples.
Automatic floor plan detection is handled with IARegion
events as described in the floor detection chapter. For your convenience, IndoorAtlas SDK also provides an API for fetching the floor plan images that you have stored in our cloud in the mapping phase.
Note! |
If you use an indoor map provider, you probably want to skip this and use their API for displaying the floor plan instead. |
IARegion class has two properties relating to the new functionality: floorplan and venue. The properties will return the metadata relating to either the floor plan or venue, depending which one the IARegion corresponds to (as previously, type can be checked with type property). We have also added new class IAVenue which represents the metadata for venue.
Loading floor plan is done in two steps:
1. Implement the IARegionListener
private IARegion.Listener mRegionListener = new IARegion.Listener() { @Override public void onEnterRegion(IARegion region) { if (region.getType() == IARegion.TYPE_FLOOR_PLAN) { handleFloorPlanChange(region.getFloorPlan()); } } @Override public void onExitRegion(IARegion region) { // leaving a previously entered region } }; Java
2. Fetch the image bitmap
import com.squareup.picasso.Picasso; // ... private void handleFloorPlanChange(IAFloorPlan newFloorPlan) { Picasso.with(this) .load(newFloorPlan.getUrl()) .into(mFloorPlanImage); }