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:ca.zadrox.dota2esportticker.ui.TeamSearchActivity.java

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

    LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(this);

    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction(UpdateTeamsService.STATUS_COMPLETED);
    intentFilter.addAction(UpdateTeamsService.STATUS_ERROR);
    intentFilter.addAction(UpdateTeamsService.STATUS_NO_CONNECTIVITY);
    intentFilter.addAction(UpdateTeamsService.STATUS_UPDATING);

    localBroadcastManager.registerReceiver(mSearchReceiver, intentFilter);
}

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

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

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

@Override
public void onStart() {
    super.onStart();
    mTickerStopped = false;/*from   w  w w .j  av a2  s .c o m*/
    mHandler = new Handler();

    mTicker = new Runnable() {

        @Override
        public void run() {
            if (mTickerStopped)
                return;
            if (mListView != null && !mBusy) {
                mAdapter.notifyDataSetChanged();
            }
            final long now = SystemClock.uptimeMillis();
            final long next = now + TICKER_DURATION - now % TICKER_DURATION;
            mHandler.postAtTime(mTicker, next);
        }
    };
    mTicker.run();
    final IntentFilter filter = new IntentFilter();
    filter.addAction(BROADCAST_ACCOUNT_LIST_DATABASE_UPDATED);
    filter.addAction(BROADCAST_RECEIVED_DIRECT_MESSAGES_DATABASE_UPDATED);
    filter.addAction(BROADCAST_SENT_DIRECT_MESSAGES_DATABASE_UPDATED);
    filter.addAction(BROADCAST_REFRESHSTATE_CHANGED);
    filter.addAction(BROADCAST_RECEIVED_DIRECT_MESSAGES_REFRESHED);
    filter.addAction(BROADCAST_SENT_DIRECT_MESSAGES_REFRESHED);
    registerReceiver(mStatusReceiver, filter);
    if (mService.isReceivedDirectMessagesRefreshing() || mService.isSentDirectMessagesRefreshing()) {
        setRefreshing(false);
    } else {
        onRefreshComplete();
    }
}

From source file:com.inovex.zabbixmobile.push.NotificationService.java

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

    ZaxPreferences preferences = ZaxPreferences.getInstance(getApplicationContext());
    oldNotificationIcons = preferences.isOldNotificationIcons();
    ringtone = preferences.getPushRingtone();
    okRingtone = preferences.getPushOkRingtone();

    // Register the notification broadcast receiver.
    IntentFilter filter = new IntentFilter();
    filter.addAction(ACTION_ZABBIX_NOTIFICATION);
    mNotificationBroadcastReceiver = new NotificationBroadcastReceiver();
    try {/*from  ww  w  . j  a  va 2s. c o m*/
        registerReceiver(mNotificationBroadcastReceiver, filter);
    } catch (Exception e) {
    }
    filter = new IntentFilter();
    filter.addAction(ACTION_ZABBIX_NOTIFICATION_DELETE);
    mNotificationDeleteBroadcastReceiver = new NotificationDeleteReceiver();
    try {
        registerReceiver(mNotificationDeleteBroadcastReceiver, filter);
    } catch (Exception e) {
    }
}

From source file:com.hwx.wheel.steeringwheel.bluetooth.ScaleActivity.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    if (D)//from   w w w.j  av  a  2  s .c om
        Log.e(TAG, "+++ ON CREATE +++");
    setContentView(R.layout.bluetooth_other);
    connect_state = (TextView) findViewById(R.id.connect_state);
    text_data = (TextView) findViewById(R.id.text_data);
    CONNECT_MAC = AppConfig.getInstance().getString("isEmpetConnectMac", "");
    mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
    itemClickAdapter = new ItemClickAdapter(deviceList);
    if (mBluetoothAdapter == null) {
        Toast.makeText(this, "Bluetooth is not available", Toast.LENGTH_LONG).show();
        finish();
        return;
    }
    IntentFilter filter = new IntentFilter();
    filter.addAction(BluetoothDevice.ACTION_FOUND);
    filter.addAction(BluetoothAdapter.ACTION_DISCOVERY_FINISHED);
    LocalBroadcastManager.getInstance(Application.getContext()).registerReceiver(mReceiver, filter);
    new CommandReceiver() {
        @Override
        public void onDataReceived(byte[] buffer, byte function, byte safeCod) {
        }

        @Override
        public void onFail() {
            connect_state.setText("fail connect");
            builder.setLength(0);
            connect_state.postDelayed(() -> startOpen(), 3000);
            startOpen();
        }

        @Override
        public void onLost() {
            connect_state.setText("lost connect");
            builder.setLength(0);
            connect_state.postDelayed(() -> startOpen(), 3000);
        }

        @Override
        public void onDeviceInfo(String name, String address) {
            connect_state.append("\t" + name);
        }

        @Override
        public void onStadeTag(int stade) {
            switch (stade) {
            case 0:
                connect_state.setText("we're doing nothing");
                break;
            case 1:
                connect_state.setText("now listening for incoming connections");
                break;
            case 2:
                connect_state.setText("now initiating an outgoing connection");
                break;
            case 3:
                connect_state.setText("now connected to a remote " + CONNECT_NAME);
                break;
            }
        }
    }.regiest();
    getSupportFragmentManager().beginTransaction().replace(R.id.content_frame, ControlFragment.newInstance(1))
            .commit();
}

From source file:com.coinblesk.client.TransactionDetailActivity.java

@Override
public void onStart() {
    super.onStart();
    Intent intent = new Intent(this, WalletService.class);
    bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE);

    IntentFilter filter = new IntentFilter(Constants.WALLET_TRANSACTION_CONFIDENCE_CHANGED_ACTION);
    filter.addAction(Constants.WALLET_DOWNLOAD_DONE_ACTION);
    LocalBroadcastManager.getInstance(this).registerReceiver(walletBalanceChangeBroadcastReceiver, filter);
}

From source file:com.coinblesk.client.wallet.WalletAddressList.java

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

    IntentFilter walletEventFilter = new IntentFilter();
    walletEventFilter.addAction(Constants.WALLET_BALANCE_CHANGED_ACTION);
    walletEventFilter.addAction(Constants.WALLET_SCRIPTS_CHANGED_ACTION);
    LocalBroadcastManager.getInstance(getActivity()).registerReceiver(walletEventReceiver, walletEventFilter);
}

From source file:com.darly.im.ui.CCPFragment.java

/**
 * Action????/*from w w w.j ava 2 s  . c o  m*/
 * Action
 * @param actionArray
 */
protected final void registerReceiver(String[] actionArray) {
    if (actionArray == null) {
        return;
    }
    IntentFilter intentfilter = new IntentFilter();
    for (String action : actionArray) {
        intentfilter.addAction(action);
    }
    //intentfilter.addAction(CASIntent.ACTION_SERVICE_DESTORY);
    //intentfilter.addAction(CASIntent.ACTION_FORCE_DEACTIVE);
    if (internalReceiver == null) {
        internalReceiver = new InternalReceiver();
    }
    getActivity().registerReceiver(internalReceiver, intentfilter);
}

From source file:com.acrr.acdisplay.services.activemode.ActiveModeService.java

@Override
public void onStart(Object... objects) {
    if (DEBUG)//from   w w w . j a  v a  2s .co  m
        Log.d(TAG, "Starting listening to sensors.");

    Context context = getContext();
    SensorManager sensorManager = (SensorManager) context.getSystemService(Context.SENSOR_SERVICE);
    for (ActiveModeSensor sensor : mSensors) {
        sensor.registerCallback(this);
        sensor.onAttached(sensorManager, context);
    }

    mActiveChargingEnabled = Config.getInstance().isActiveModeActiveChargingEnabled();
    if (mActiveChargingEnabled) {
        mPluggedAtomic.react(PowerUtils.isPlugged(context));

        IntentFilter intentFilter = new IntentFilter();
        intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
        context.registerReceiver(mReceiver, intentFilter);
    }
}

From source file:com.lithiumli.fiction.FictionActivity.java

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

    Log.d("fiction", "resuming");

    // Playback stuff
    Intent intent = new Intent(this, PlaybackService.class);
    startService(intent);//  www  . ja v a2s  .  c  o m
    Log.d("fiction", "binding");
    intent = new Intent(this, PlaybackService.class);
    bindService(intent, mConnection, Context.BIND_AUTO_CREATE);

    IntentFilter filter = new IntentFilter();
    filter.addAction(PlaybackService.EVENT_PLAYING);
    filter.addAction(PlaybackService.EVENT_PLAY_STATE);
    LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, filter);
}