Example usage for android.content IntentFilter addAction

List of usage examples for android.content IntentFilter addAction

Introduction

In this page you can find the example usage for android.content IntentFilter addAction.

Prototype

public final void addAction(String action) 

Source Link

Document

Add a new Intent action to match against.

Usage

From source file:com.abs.telecam.gui.ControllerViewer.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    mPageNumber = getArguments().getInt(ARG_PAGE);
    controllerBindings = new ControllerBindings(getActivity());
    galleryBindings = new GalleryBindings(getActivity());
    dialogHelper = new DialogHelper(getActivity());
    TeleCam.newDevicesArrayAdapter = new DeviceBluetoothAdapter(getActivity(),
            android.R.layout.select_dialog_singlechoice);
    IntentFilter filter = new IntentFilter(BluetoothDevice.ACTION_FOUND);
    filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
    filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    getActivity().registerReceiver(mReceiver, filter);
}

From source file:com.codefororlando.transport.MapsActivity.java

@Override
protected void onResume() {
    super.onResume();
    setUpMapIfNeeded(null);// w  w  w. j a va 2s . c  o  m

    final IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ACTION_BIKE_MARKER_SELECTED);
    intentFilter.addAction(ACTION_PARKING_MARKER_SELECTED);
    intentFilter.addAction(ACTION_EVENT_MARKER_SELECTED);

    LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(broadcastReceiver,
            intentFilter);

    // FIXME Filter should save state to prevent ghost touch of recyclerview
    filterView.animateOnScreen(true);
    filterView.animateOnScreen(getFragmentManager().findFragmentByTag(ISelectableItemFragment.TAG) == null);
}

From source file:com.example.testplayer.NetworkManager.java

/**
 * Sets the context of the Command. This can then be used to do things like
 * get file paths associated with the Activity.
 *
 * @param cordova The context of the main Activity.
 * @param webView The CordovaWebView Cordova is running in.
 *///w  ww.  j  a  v  a2  s.c om
public void initialize(CordovaInterface cordova, CordovaWebView webView) {
    super.initialize(cordova, webView);
    this.sockMan = (ConnectivityManager) cordova.getActivity().getSystemService(Context.CONNECTIVITY_SERVICE);
    this.connectionCallbackContext = null;

    // We need to listen to connectivity events to update navigator.connection
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    if (this.receiver == null) {
        this.receiver = new BroadcastReceiver() {
            @Override
            public void onReceive(Context context, Intent intent) {
                // (The null check is for the ARM Emulator, please use Intel Emulator for better results)
                if (NetworkManager.this.webView != null)
                    updateConnectionInfo(sockMan.getActiveNetworkInfo());
            }
        };
        webView.getContext().registerReceiver(this.receiver, intentFilter);
    }

}

From source file:com.lge.helloFriendsCamera.MainActivity.java

private IntentFilter getFilter() {
    IntentFilter mFilter = new IntentFilter();
    mFilter.addAction(WifiClient.ACTION_WIFI_STATE);
    return mFilter;
}

From source file:com.google.android.car.kitchensink.bluetooth.MapMceTestFragment.java

@Override
public void onResume() {
    super.onResume();

    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    mBluetoothAdapter.getProfileProxy(getContext(), new MapServiceListener(), BluetoothProfile.MAP_CLIENT);

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(BluetoothMapClient.ACTION_MESSAGE_SENT_SUCCESSFULLY);
    intentFilter.addAction(BluetoothMapClient.ACTION_MESSAGE_DELIVERED_SUCCESSFULLY);
    intentFilter.addAction(BluetoothMapClient.ACTION_MESSAGE_RECEIVED);
    intentFilter.addAction(BluetoothMapClient.ACTION_CONNECTION_STATE_CHANGED);
    getContext().registerReceiver(mTransmissionStatusReceiver, intentFilter);
}

From source file:arun.com.chromer.appdetect.AppDetectService.java

private void registerScreenReceiver() {
    final IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
    filter.addAction(Intent.ACTION_SCREEN_OFF);
    screenStateReceiver = new ScreenStateReceiver();
    registerReceiver(screenStateReceiver, filter);
}

From source file:com.amazon.analytics.AnalyticsManager.java

/**
 * Singleton constructor.//  w  w w  . j a v a  2  s.  c o  m
 *
 * @param context Context.
 */
private AnalyticsManager(Context context) {

    mAppContext = context.getApplicationContext();

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ANALYTICS_INTENT_ACTION);
    LocalBroadcastManager.getInstance(mAppContext).registerReceiver(mLocalBroadcastReceiver, intentFilter);
}

From source file:com.example.android.notifyme.MainActivity.java

/**
 * Initializes the activity//from w  ww. ja va  2s . c  o m
 * @param savedInstanceState The current state data
 */
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mNotifyManager = (NotificationManager) getSystemService(NOTIFICATION_SERVICE);

    mNotifyButton = (Button) findViewById(R.id.notify);
    mUpdateButton = (Button) findViewById(R.id.update);
    mCancelButton = (Button) findViewById(R.id.cancel);

    mNotifyButton.setEnabled(true);
    mUpdateButton.setEnabled(false);
    mCancelButton.setEnabled(true);

    //Initialize and register the notification receiver
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ACTION_UPDATE_NOTIFICATION);
    intentFilter.addAction(ACTION_CANCEL_NOTIFICATION);
    registerReceiver(mReceiver, intentFilter);

    //Set OnClick methods.
    mNotifyButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            sendNotification();
        }
    });

    mUpdateButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            updateNotification();
        }
    });

    mCancelButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            cancelNotification();
        }
    });

}

From source file:com.android.camera.processing.ProcessingService.java

@Override
public void onCreate() {
    mProcessingServiceManager = ProcessingServiceManager.instance();
    mSessionManager = getServices().getCaptureSessionManager();

    // Keep CPU awake while allowing screen and keyboard to switch off.
    PowerManager powerManager = AndroidServices.instance().providePowerManager();
    mWakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, TAG.toString());
    mWakeLock.acquire();/* w w w .j  ava 2 s. c o m*/

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ACTION_PAUSE_PROCESSING_SERVICE);
    intentFilter.addAction(ACTION_RESUME_PROCESSING_SERVICE);
    LocalBroadcastManager.getInstance(this).registerReceiver(mServiceController, intentFilter);
    mNotificationBuilder = createInProgressNotificationBuilder();
    mNotificationManager = AndroidServices.instance().provideNotificationManager();
}

From source file:com.dwdesign.tweetings.fragment.ParcelableStatusesListFragment.java

@Override
public void onStart() {
    super.onStart();
    final IntentFilter filter = new IntentFilter(BROADCAST_STATUS_DESTROYED);
    filter.addAction(BROADCAST_RETWEET_CHANGED);
    filter.addAction(BROADCAST_TWITLONGER_EXPANDED);
    registerReceiver(mStateReceiver, filter);
}