FileDocCategorySizeDatePackage
CountryDetectorBase.javaAPI DocAndroid 5.1 API2184Thu Mar 12 22:22:42 GMT 2015com.android.server.location

CountryDetectorBase

public abstract class CountryDetectorBase extends Object
This class defines the methods need to be implemented by the country detector.

Calling {@link #detectCountry} to start detecting the country. The country could be returned immediately if it is available.

hide

Fields Summary
protected final android.os.Handler
mHandler
protected final android.content.Context
mContext
protected android.location.CountryListener
mListener
protected android.location.Country
mDetectedCountry
Constructors Summary
public CountryDetectorBase(android.content.Context ctx)

        mContext = ctx;
        mHandler = new Handler();
    
Methods Summary
public abstract android.location.CountrydetectCountry()
Start detecting the country that the user is in.

return
the country if it is available immediately, otherwise null should be returned.

protected voidnotifyListener(android.location.Country country)

        if (mListener != null) {
            mListener.onCountryDetected(country);
        }
    
public voidsetCountryListener(android.location.CountryListener listener)
Register a listener to receive the notification when the country is detected or changed.

The previous listener will be replaced if it exists.

        mListener = listener;
    
public abstract voidstop()
Stop detecting the country. The detector should release all system services and be ready to be freed