FusedLocationProviderpublic 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 | mHandlerFor 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);
|
|