Android Chinese API (133) -- LocationListener

Source: Internet
Author: User

 

Preface

This chapter is about android. location. locationListener, for GPS related chapter, version for Android 3.2 r1, translated from "pandatv 82", welcome to visit his blog: "http://wisekingokok.cnblogs.com", thanks again "pandatv 82 "! Welcome to join in Android Chinese translation, contact me over140@gmail.com.

 

Statement

You are welcome to repost, but please keep the original source of the article :)

Blog Garden: http://www.cnblogs.com/

Android Chinese translation group: http://goo.gl/6vJQl

 

 

LocationListener

Translator's signature: pandatv 82

Link: http://wisekingokok.cnblogs.com

Version: Android 3.2 r1

 

Structure

Inheritance relationship

Public interface LocationListener

Android. location. LocationListener

 

Class Overview

It is used to receive notifications when the location from the LocationManager changes. If the LocationListener is registered and added to the LocationManager object, and the LocationManager object calls the requestLocationUpdates (String, long, float, LocationListener) method, the related methods in the interface will be called

 

Common Methods

Public abstract voidOnLocationChanged(Location location)

This method is called when the location changes. The Location object can be used without restrictions.

Parameters

The new location after the location changes.

 

Public abstract voidOnProviderDisabled(String provider)

This method is called after the provider is disabled by the user. If the requestLocationUpdates method called based on a closed provider is called, this method is called.

Parameters

The name of the location provider associated with it.

 

Public abstract voidOnPorviderEnabled(Location location)

This method is called after the provider is enabled by the user.

Parameters

The name of the location provider associated with the provider.

 

Public abstract voidOnStatusChanged(String provider, int Status, Bundle extras)

This method is called when the Provider status is directly switched to the available, temporarily unavailable, or no-service status.

Parameters

The location provider name related to the change.

Status: if the service is stopped and does not change in a short period of time, the status code is OUT_OF_SERVICE. if the service is temporarily stopped and will be restored within a short period of time, the status code is TEMPORARILY_UNAVAILABLE; if the service is valid, the status code is AVAILABLE.

Extras is an optional set of parameters that contain the specific status of the provider. The following lists a group of common key-value pairs. In fact, the value that any key provider needs to provide. • Positioning satellites-a group of satellites used for device Positioning

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.