Chapter 6. Location, Location, Location

One of the biggest reasons that smartphones have taken off in recent years is their ability to provide real-time information about what’s around you. You can look up restaurants in the area, read reviews about them, browse their menus, and even make a reservation. If you’re lost, you can quickly pinpoint your location on a map and get directions to where you need to go. Having access to the user’s current location is a very powerful feature, and can allow your application to provide a very personalized and localized experience to the user.

This chapter will introduce the location and mapping capabilities of each platform. Whereas the previous chapters focused largely on sharing code across them, the applications in this chapter will be independent from each other, despite providing the same functionality. That’s not to say that there is no potential code reuse in these scenarios, though. If you recall, the example in Chapter 2 demonstrated how you might apply the abstraction pattern to building an application that utilizes the user’s location. Since each platform has its own way of doing mapping and location, it makes sense to assess them individually rather than rushing into an abstraction.

The applications in this chapter will be built in two phases. In the first, the user will see a map centered on New York City, where she can zoom and pan around, and where there will be a marker showing the location. The second part of this chapter will ...

Get Mobile Development with C# now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.