Android navigation application based on Google Map Api

I. Introduction

The application of navigation software in smartphones has become one of the research hotspots. Under the dual drive that most smartphones currently provide GPS positioning services and the increasing popularity of 3G wireless networks, it is feasible to implement navigation services in Google Maps.

This article proposes and implements an Android navigation application based on Google Map Api, which can provide users with humanized and intelligent map navigation services.

Second, the system architecture

Three, UI interface design

The basic functional unit of an Android application is an object in the AcTIvity class. The main functions of AcTIvity are interface display and event processing. In AcTIvity, use View and ViewGroup controls with XML styles for interface design, and use event processing for human-computer interaction. The main event processing is button events, touch screen events, and event monitoring of some advanced controls. The UI interface is formed by setting controls and event processing.

1. Display of GPS positioning information

Display positioning information through the textView control. When the program is opened, the current user's specific location and zip code, house number and other related information are displayed. If GPS positioning is unsuccessful or an error occurs, "Cannot obtain the current address" is displayed.

2. The user enters the navigation start location

By setting the EditView control, the user can enter the starting point of the navigation that he needs to change, submit the input information by setting the ButtON control named "Navigation", and analyze the starting address when the OnButton button is monitored. If the starting address can be parsed, the navigation map is loaded. If another address fails to be parsed, the user is prompted through the dialog control Dialog "The address is entered incorrectly, please re-enter."

3. Navigation interface design

Set the WebView control in the navigation interface. The WebView control transfers information such as the starting address to the HTML navigation webpage in the server by calling each other with javascript. After obtaining the address and other information, the webpage navigates and displays it in the application navigation interface through the WebView control.

4. Voice function interface design

Set a Button control named Voice Navigation in the navigation interface. When the user presses the button, the voice navigation service is provided for the user.

The following figure shows the UI interface for positioning and entering address information:

4. GPS positioning function

Global Positioning System (Global PosiTIoning System, GPS) is a mid-range circular orbit satellite navigation system, which can provide accurate positioning, speed measurement and high-precision time standard services for more than 98% of the earth ’s surface, in all fields. It has a wide range of applications.

Android supports the API of GPS service. This service can be used to obtain the geographic location of the current device. The application obtains the geographic location through this API, and can periodically request to update the geographic location information of the current device. The system will use several important function classes in the GPS API: LocATIonManager, which is used to manage Android user location services; LocationProvider, which provides multiple positioning methods for developers to choose; Criteria, which is selected by the application through the properties set in LocationProvider Appropriate positioning provider.

The steps to obtain the user's current location are as follows:

1. Declare the corresponding permissions in AndroidManifeST.xml:

<android: name = "" android.permission.ACCESS_COARSE_LOCATION "" permission>

2. Get the LocationManager object:

LocationManager locationManager = (LocationManager) getSystemSERvice (Context.LOCATION_SERVICE);

3. Set the Criteria object:

Criteria criteria = newCriteria ();

criteria.setAccuracy (Criteria.ACCURACY_FINE);

criteria.setAltitudeRequired (false);

criteria.setBearingRequired (false);

criteria.setCostAllowed (false);

criteria.setPowerRequirement (Criteria.POWER_LOW);

4. Set Provider:

String provider = locationManager.getBestProvider (criteria, true);

Location location = locationManager.getLastKnownLocation (provider);

Hifi Earphones

Hifi Earbuds,Best Hifi Earbuds,Hifi In Ear Headphones,Best Hifi Earphones

Dongguang Vowsound Electronics Co., Ltd. , https://www.vowsound.com