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.macleod2486.androidswissknife.components.NFCTool.java

private void setUpWrite(String message) {

    Log.i("NFCTool", "Message received " + message);
    Intent nfcIntent = new Intent(activity.getApplicationContext(), NFCActivity.class);
    nfcIntent.putExtra("NFCMode", "write");
    nfcIntent.putExtra("NFCMessage", message);
    nfcIntent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);

    PendingIntent pendingIntent = PendingIntent.getActivity(activity, 0, nfcIntent, 0);

    IntentFilter filter = new IntentFilter();
    filter.addAction(NfcAdapter.ACTION_TAG_DISCOVERED);
    filter.addAction(NfcAdapter.ACTION_NDEF_DISCOVERED);
    filter.addAction(NfcAdapter.ACTION_TECH_DISCOVERED);

    IntentFilter[] filterArray = new IntentFilter[] { filter };

    String[][] techListsArray = new String[][] { new String[] { Ndef.class.getName() },
            new String[] { Ndef.class.getName() } };

    adapter.disableReaderMode(activity);
    adapter.enableForegroundDispatch(activity, pendingIntent, filterArray, techListsArray);

    Toast.makeText(this.activity, "Please scan tag with device.", Toast.LENGTH_LONG).show();
}

From source file:com.comapi.internal.push.PushManager.java

/**
 * Register local broadcast listener for refreshed push tokens and push messages.
 *
 * @param context         Application context.
 * @param provider        Provides fcm push token.
 * @param tokenListener   Listener for refreshed push tokens.
 * @param messageListener Listener for push messages.
 */// ww w  . j  a  va2 s  .  c  o  m
private void registerPushReceiver(final Handler mainThreadHandler, final Context context,
        PushTokenProvider provider, final PushTokenListener tokenListener,
        final PushMessageListener messageListener) {

    IntentFilter filter = new IntentFilter();
    filter.addAction(IDService.ACTION_REFRESH_PUSH);
    filter.addAction(PushService.ACTION_PUSH_MESSAGE);

    receiver = new PushBroadcastReceiver(mainThreadHandler, provider, tokenListener, messageListener);
    LocalBroadcastManager.getInstance(context.getApplicationContext()).registerReceiver(receiver, filter);
}

From source file:com.amlcurran.messages.events.BroadcastEventSubscriber.java

private IntentFilter buildMessageFilter(Broadcast[] broadcasts) {
    IntentFilter filter = new IntentFilter();
    for (Broadcast broadcast : broadcasts) {
        filter.addAction(broadcast.getAction());
    }//  w  ww. j av a 2s .c om
    return filter;
}

From source file:com.coinomi.wallet.ui.ExchangeRateLoader.java

@Override
protected void onStartLoading() {
    super.onStartLoading();

    refreshUri(config.getExchangeCurrencyCode());

    config.registerOnSharedPreferenceChangeListener(this);

    final IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    intentFilter.addAction(Intent.ACTION_TIME_TICK);
    context.registerReceiver(broadcastReceiver, intentFilter);

    forceLoad();// ww  w  .ja  va  2s  . c o m
}

From source file:com.cleanwiz.applock.ui.BaseActivity.java

@Override
protected void onCreate(Bundle savedInstanceState) {
    AppLockApplication.getInstance().doForCreate(this);
    super.onCreate(savedInstanceState);
    IntentFilter filter = new IntentFilter();
    filter.addAction("finish");
    registerReceiver(mFinishReceiver, filter);

    SystemBarTintManager tintManager = new SystemBarTintManager(this);
    tintManager.setStatusBarTintEnabled(true);
    tintManager.setNavigationBarTintEnabled(true);
    tintManager.setTintColor(getResources().getColor(R.color.lock_status_alpha));
}

From source file:com.android.dragonkeyboardfirmwareupdater.KeyboardFirmwareUpdateService.java

private static IntentFilter makeIntentFilter() {
    IntentFilter intentFilter = new IntentFilter();

    intentFilter.addAction(BluetoothAdapter.ACTION_CONNECTION_STATE_CHANGED);
    intentFilter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
    intentFilter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
    intentFilter.addAction(ACTION_KEYBOARD_UPDATE_CONFIRMED);
    intentFilter.addAction(ACTION_KEYBOARD_UPDATE_POSTPONED);

    return intentFilter;
}

From source file:com.chalmers.feedlr.ui.FeedFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    Bundle arg = getArguments();//from  w ww . ja va  2  s . co m
    feedTitle = arg.getString("title");

    lbm = LocalBroadcastManager.getInstance(getActivity());

    IntentFilter filter = new IntentFilter();
    filter.addAction(FeedActivity.FEED_UPDATED);
    filter.addAction(FeedActivity.FEED_PROBLEM_UPDATING);
    filter.addAction(FeedActivity.NO_CONNECTION);
    lbm.registerReceiver(receiver, filter);
}

From source file:com.liferay.alerts.activity.SignInActivity.java

private void _registerBroadcastReceiver() {
    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_FINISH);

    _receiver = new BroadcastReceiver() {

        @Override/* www.j a  va  2s  . c o  m*/
        public void onReceive(Context context, Intent intent) {
            String action = intent.getAction();

            if (ACTION_FINISH.equals(action)) {
                startActivity(new Intent(context, MainActivity.class));
                finish();
            }
        }

    };

    _getBroadcastManager().registerReceiver(_receiver, filter);
}

From source file:ch.bfh.instacircle.ParticipantDetailFragment.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    // Subscibing to the participantJoined and participantChangedState
    // events to update immediately
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("messageArrived");
    intentFilter.addAction("participantChangedState");
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(mMessageReceiver, intentFilter);

}

From source file:com.example.parking.ParkingSpaceDetailActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_parking_space_detail);
    mParkingInformationTV = (TextView) findViewById(R.id.parkingInformation);
    mRecordOfTodayTV = (TextView) findViewById(R.id.recordOfToday);
    mParkingInformationTV.setOnClickListener(mTabClickListener);
    mRecordOfTodayTV.setOnClickListener(mTabClickListener);
    changeSelect(R.id.parkingInformation);
    changeFragment(R.id.parkingInformation);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    IntentFilter filter = new IntentFilter();
    filter.addAction("ExitApp");
    filter.addAction("BackMain");
    registerReceiver(mReceiver, filter);
}