We have seen that each POI has a POI category associated with it. Situm Platform has a set of default/predefined categories such as "Coffee", "Elevator", "Entrance"... or "No category", which is a special category reserved for POIs that are not associated with any particular POI Category. Additionally, the user may also define its own category in Situm Dashboard.


For detailed information on POI Categories, you may also read their introductory description.  You may also find interesting their data models as provided by Situm REST API Get POI Categories method and Situm SDK POI Category model


Fetching all the POI Categories of the user 


The following code snippet shows how to retrieve the POIs categories of the user's account and output their information on the application Log.  
//Fetches all the POI Categories of the user's account
SitumSdk.communicationManager().fetchPoiCategories(new Handler<Collection<PoiCategory>>() {
    @Override
    public void onSuccess(Collection<PoiCategory> poiCategories) {

        //We loop over all the POI categories to log their information
        for (PoiCategory poiCategory: poiCategories){
            Log.i(TAG, "POICategoryID: "+ poiCategory.getIdentifier());
            Log.i(TAG, "  POICategoryName: "+ poiCategory.getName());
            Log.i(TAG, "  POICategoryNameI18n: "+ poiCategory.getNameAsI18n());
            Log.i(TAG, "  POICategoryCode: "+ poiCategory.getCode());
            Log.i(TAG, "  POICategoryCustomFields: "+ poiCategory.getCustomFields());

            Log.i(TAG, "  POICategorySelectedIconURL: "+ poiCategory.getSelectedIconUrl());
            Log.i(TAG, "  POICategorySelectedIconURL: "+ poiCategory.getUnselectedIconUrl());
        }
    }

    @Override
    public void onFailure(Error error) {
Log.e(TAG, "Error " + error);
    }
});


The resulting log will be something like:

POICategoryID: 1
  POICategoryName: Coffee
  POICategoryNameI18n: I18nString{values={spa=Cafetería, eng=Coffee}}
  POICategoryCode: situm-coffee
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/1/fcfb13c6-44e7-4b58-b568-780ef41628f1.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/1/b3d4b884-ed86-4ab5-929d-3e5a40502e56.png', isAbsolute=false}
POICategoryID: 2
  POICategoryName: Elevator
  POICategoryNameI18n: I18nString{values={spa=Ascensor, eng=Elevator}}
  POICategoryCode: situm-elevator
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/2/f43bbdb4-4844-4147-9a1f-e7db307bc439.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/2/9b3247fd-148d-4098-82a3-3e4d6e4deb33.png', isAbsolute=false}
POICategoryID: 3
  POICategoryName: Entrance
  POICategoryNameI18n: I18nString{values={spa=Acceso, eng=Entrance}}
  POICategoryCode: situm-entrance
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/3/4618b474-efb3-4152-b5c2-1ba2c2dabcc0.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/3/1999aa2f-c137-469d-83cd-4c3624bec39d.png', isAbsolute=false}
POICategoryID: 4
  POICategoryName: Information
  POICategoryNameI18n: I18nString{values={spa=Información, eng=Information}}
  POICategoryCode: situm-info
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/4/331a12fc-bef3-4b78-b5aa-6b2e98fc2b16.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/4/91f3a501-5f71-4a67-8ea3-b8e1a63eb911.png', isAbsolute=false}
POICategoryID: 5
  POICategoryName: Parking
  POICategoryNameI18n: I18nString{values={spa=Aparcamiento, eng=Parking}}
  POICategoryCode: situm-parking
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/5/77719daa-4e0e-468c-9ca6-05516053304d.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/5/c9858e94-c49a-4d3a-be3d-278168fa611a.png', isAbsolute=false}
POICategoryID: 6
  POICategoryName: Ramp
  POICategoryNameI18n: I18nString{values={spa=Rampa, eng=Ramp}}
  POICategoryCode: situm-ramp
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/6/8b1efad0-9e3c-4e47-941a-18ed88aecab4.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/6/e3c0d140-f2e9-4088-ab9f-77fa54c4adc7.png', isAbsolute=false}
POICategoryID: 7
  POICategoryName: Shop
  POICategoryNameI18n: I18nString{values={spa=Tienda, eng=Shop}}
  POICategoryCode: situm-shop
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/7/2038ed3a-d5c3-4aee-9ca5-2e994b717bcc.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/7/76bfcad9-5df2-4331-85a7-b51e03379883.png', isAbsolute=false}
POICategoryID: 8
  POICategoryName: Stairs
  POICategoryNameI18n: I18nString{values={spa=Escaleras, eng=Stairs}}
  POICategoryCode: situm-stairs
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/8/2c7aaeba-8695-4272-a35d-222675b9f788.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/8/5e81ef12-d5e4-4213-ad24-25db43ac2911.png', isAbsolute=false}
POICategoryID: 9
  POICategoryName: Toilets
  POICategoryNameI18n: I18nString{values={spa=Aseos, eng=Toilets}}
  POICategoryCode: situm-toilets
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/9/95a7f721-3a00-481e-8786-6126e8d6533e.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/9/5a6a82df-1b47-4afa-bf91-5c06427fb0a7.png', isAbsolute=false}
POICategoryID: 148
  POICategoryName: No category
  POICategoryNameI18n: I18nString{values={spa=Sin categoría, eng=No category}}
  POICategoryCode: situm-default
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/148/4c85ebd0-6ff2-4c1d-bad5-1f9f9eedc847.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/148/8ac8e04f-a6a0-4da5-a08d-02ec33ffdcfb.png', isAbsolute=false}
POICategoryID: 1206
  POICategoryName: My Category
  POICategoryNameI18n: I18nString{values={spa=Mi categoría, eng=My Category}}
  POICategoryCode: MC
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/1206/b7bac260-f68d-4554-9054-d8a9be992618.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/1206/a04cf2b3-5c09-40d1-8dca-3f3d9ae3adde.png', isAbsolute=false}


Notice that the POICategories with IDs 1 to 9 are Situm's predefined categories and ID 148 belongs to the reserved category "No Category", which will be associated to POIs that should not belong to any category. Finally, in this particular example, category with ID 1206 is an user-defined one. Let's examine this category in detail.


POICategoryID: 1206
  POICategoryName: My Category
  POICategoryNameI18n: I18nString{values={spa=Mi categoría, eng=My Category}}
  POICategoryCode: MC
  POICategoryCustomFields: {}
  POICategorySelectedIconURL: URL{value='/uploads/poicategoryselected/1206/b7bac260-f68d-4554-9054-d8a9be992618.png', isAbsolute=false}
  POICategorySelectedIconURL: URL{value='/uploads/poicategory/1206/a04cf2b3-5c09-40d1-8dca-3f3d9ae3adde.png', isAbsolute=false}


We can see that the application log shows the main information of the POICategory data object, which includes:

  1. The identifier of the category.
  2. Its code
  3. The name of the category (shown in the locale of the smartphone).
  4. The name of the category in all the supported languages (english & spanish). 
  5. The URL to download the main icon (called Selected Icon because it is usually shown when a POI has not been selected by the user yet).
  6. The URL to download the secondary icon (called Unselected Icon because it is usually shown when a POI has been selected by the user). 






Fetching all the POI Categories Icons


In addition to retrieving all the POI Categories, you will probably want to download their icons. The following snippet shows you how to do it.


//Fetches all the POI Categories of the user's account
SitumSdk.communicationManager().fetchPoiCategories(new Handler<Collection<PoiCategory>>() {
    @Override
    public void onSuccess(Collection<PoiCategory> poiCategories) {

        //We loop over all the POI categories to download their icons
        for (final PoiCategory poiCategory: poiCategories){

            //Downloading the Main Icons (Selected Icons)
            SitumSdk.communicationManager().fetchPoiCategoryIcon(poiCategory, true, new Handler<Bitmap>() {
                @Override
                public void onSuccess(Bitmap bitmap) {
                    Log.i(TAG, "POICategoryID: " + poiCategory.getIdentifier());
                    Log.i(TAG, "   SelectedIcon hashcode: " + bitmap.hashCode());
                }

                @Override
                public void onFailure(Error error) {
                    Log.e(TAG, "Error " + error);
                }
            });

            //Downloading the Secondary Icons (Unselected Icons)
            SitumSdk.communicationManager().fetchPoiCategoryIcon(poiCategory, false, new Handler<Bitmap>() {
                @Override
                public void onSuccess(Bitmap bitmap) {
                    Log.i(TAG, "POICategoryID: " + poiCategory.getIdentifier());
                    Log.i(TAG, "   UnselectedIcon hashcode: " + bitmap.hashCode());
                }

                @Override
                public void onFailure(Error error) {
                    Log.e(TAG, "Error " + error);
                }
            });

        }
    }

    @Override
    public void onFailure(Error error) {
        Log.e(TAG, "Error " + error);
    }
});


Note that the icons are provided as Android Bitmap objects. As an example, the previous snippet shows the hash code of each icon.

POICategoryID: 1
   SelectedIcon hashcode: 27274630
POICategoryID: 1
   UnselectedIcon hashcode: 179725895
POICategoryID: 2
   SelectedIcon hashcode: 79519348
POICategoryID: 2
   UnselectedIcon hashcode: 153141149
POICategoryID: 3
   SelectedIcon hashcode: 230792210
POICategoryID: 3
   UnselectedIcon hashcode: 15278051
POICategoryID: 4
   SelectedIcon hashcode: 126610912
POICategoryID: 4
   UnselectedIcon hashcode: 72267929
POICategoryID: 5
   SelectedIcon hashcode: 18442078
POICategoryID: 5
   UnselectedIcon hashcode: 100915007
POICategoryID: 6
   SelectedIcon hashcode: 82970636
POICategoryID: 6
   UnselectedIcon hashcode: 248071509
POICategoryID: 7
   SelectedIcon hashcode: 59808618
POICategoryID: 7
   UnselectedIcon hashcode: 32024667
POICategoryID: 8
   SelectedIcon hashcode: 79534328
POICategoryID: 8
   UnselectedIcon hashcode: 19259857
POICategoryID: 9
   SelectedIcon hashcode: 9765942
POICategoryID: 9
   UnselectedIcon hashcode: 243232567
POICategoryID: 148
   SelectedIcon hashcode: 196037796
POICategoryID: 148
   UnselectedIcon hashcode: 232114701
POICategoryID: 1206
   SelectedIcon hashcode: 178597314
POICategoryID: 1206
   UnselectedIcon hashcode: 38914003