FileDocCategorySizeDatePackage
FusedLocationProvider.javaAPI DocAndroid 5.1 API4406Thu Mar 12 22:22:40 GMT 2015com.android.location.fused

FusedLocationProvider

public class FusedLocationProvider extends com.android.location.provider.LocationProviderBase implements FusionEngine.Callback

Fields Summary
private static final String
TAG
private static com.android.location.provider.ProviderPropertiesUnbundled
PROPERTIES
private static final int
MSG_ENABLE
private static final int
MSG_DISABLE
private static final int
MSG_SET_REQUEST
private final android.content.Context
mContext
private final FusionEngine
mEngine
private android.os.Handler
mHandler
For serializing requests to mEngine.
Constructors Summary
public FusedLocationProvider(android.content.Context context)

        super(TAG, PROPERTIES);
        mContext = context;
        mEngine = new FusionEngine(context, Looper.myLooper());

        // listen for user change
        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(Intent.ACTION_USER_SWITCHED);
        mContext.registerReceiverAsUser(new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                String action = intent.getAction();
                if (Intent.ACTION_USER_SWITCHED.equals(action)) {
                    mEngine.switchUser();
                }
            }
        }, UserHandle.ALL, intentFilter, null, mHandler);
    
Methods Summary
public voidonDisable()

        mHandler.sendEmptyMessage(MSG_DISABLE);
    
public voidonDump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)

        // perform synchronously
        mEngine.dump(fd, pw, args);
    
public voidonEnable()


    
       
        mHandler.sendEmptyMessage(MSG_ENABLE);
    
public intonGetStatus(android.os.Bundle extras)

        return LocationProvider.AVAILABLE;
    
public longonGetStatusUpdateTime()

        return 0;
    
public voidonSetRequest(com.android.location.provider.ProviderRequestUnbundled request, android.os.WorkSource source)

        mHandler.obtainMessage(MSG_SET_REQUEST, new RequestWrapper(request, source)).sendToTarget();