AppStudio for ArcGIS

Introducing the Nearby Sample App

We are excited to announce the release of a new sample app – Nearby – available today in AppStudio for ArcGIS! This sample showcases how to find the nearest places of interest worldwide, filter them by category, and provide step-by-step directions from your current location. Give this new app a spin using the AppStudio Player (readily available to run in the Samples tab) on your favorite mobile phone or tablet.

The source code for this sample app is available for you to inspect and customize further in AppStudio Desktop (4.0 and above) along with all the other great sample apps. Just open Desktop, click on the New App button, and either browse or type Nearby in the search box to find the sample and click Create.

Feature highlights

On start, the app finds generic places of interests (ten at the most), such as restaurants and libraries, which are located within a 20-mile radius of the device’s location. The user is then presented with a list of found places sorted by distance.

Selecting any of these places from the list will highlight the location on a map and show the place’s details, and an option to view routing directions from the device’s to the location. Moreover, as the places are also shown on the map, the user is able to select any place on the map to view detailed information and routing directions to the selected place.

Nearby sample app- show place's details
Nearby sample app- show place's details

When the user taps on “Directions”, a route to the selected place is shown on the map as well as turn-by-turn directions. By default, the sample shows driving directions, and we added an option to switch between walking and driving directions as shown in the graphic below.

Nearby sample - show direction
Nearby sample - show direction

Geocoding

The sample demonstrates the power of Esri’s Geocoding Service by providing an intuitive experience for searching nearby places by names, addresses, or categories. The user can search by taping on a category as shown below, and they will be presented with up to ten nearby places matching the selected category.

Nearby sample -search by taping on a category
Nearby sample -search by taping on a category

The sample also allows the user to search by typing a name or an address. As the user types, a list of suggestions based on the user’s input and the device’s location will be shown for the user to choose from. When a user confirms their search input or chooses from the suggestions, places matching their selection will be shown as a list and as points on the map.

 

Nearby sample - search by typing a name or an address
Nearby sample - search by typing a name or an address

Accessing the device’s location and network

The release of AppStudio 4.0 brought great new additions including the PermissionDialog QML component, and we incorporated it in the sample to make sure the user grants location access permission to the app. This ensures that the app can access the device’s location in order to show nearby places of interest, and when the location access permission has not been granted, it will notify the user and request them to allow access.

Nearby sample - request device location permission
Nearby sample - request device location permission

Additionally, since we are using online geocoding and routing services, we need to make sure that the device has an active internet connection for the app to function. Thus, we added a check for network access that will notify the user to turn on an internet connection in case the connection is lost or is not available.

Nearby sample - offline statement
Nearby sample - offline statement

Technical Highlights:

This sample app is built with ArcGIS Runtime, uses Google Material Design for the user interface, and is powered by Esri’s world Geocoding service to find places of interest such as restaurants, hotels, libraries, etc. If you are interested in the technical details and project structure of this sample app, please read this blog from AppStudio GeoNet to learn more.

 

We would like to thank Tresor Cyubahiro, one of our amazing summer interns, who helped us with this sample app. 

 

 

About the author

Tina Jin is a Product Engineer on AppStudio for ArcGIS team.

Next Article

Fast, flexible and fun: The new pop-up experience in the next generation Map Viewer Beta

Read this article