List of usage examples for android.content IntentFilter addAction
public final void addAction(String action)
From source file:com.grupohqh.carservices.operator.ReadTagActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_read_tag); URL = getString(R.string.base_url) + getString(R.string.findcarid_url); if (getIntent().getExtras().containsKey("userId")) userId = getIntent().getExtras().getInt("userId"); rgSearchBy = (RadioGroup) findViewById(R.id.rgSearchBy); etTag = (EditText) findViewById(R.id.etTag); etLicensePlate = (EditText) findViewById(R.id.etLicensePlate); etSerialNumber = (EditText) findViewById(R.id.etSerialNumber); btnSearch = (Button) findViewById(R.id.btnSearch); viewTag = findViewById(R.id.viewTag); viewPlate = findViewById(R.id.viewPlate); viewSerial = findViewById(R.id.viewSerial); changeVisibility(rgSearchBy.getCheckedRadioButtonId()); rgSearchBy.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() { @Override// ww w. j a v a2 s. c om public void onCheckedChanged(RadioGroup group, int checkedId) { changeVisibility(checkedId); } }); btnSearch.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { if (validate()) { new HttpAsyncTask().execute(URL); } } }); if (useMiniMe) { manager = (UsbManager) getSystemService(Context.USB_SERVICE); usbCommunication = UsbCommunication.newInstance(); IntentFilter filter = new IntentFilter(); filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED); // will intercept by system filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED); filter.addAction(ACTION_USB_PERMISSION); registerReceiver(usbReceiver, filter); etEpc = (EditText) findViewById(R.id.etEPC); btnRead = (Button) findViewById(R.id.btnReadTAG); txtStatus = (TextView) findViewById(R.id.txtStatus); btnRead.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { etEpc.setText(""); if (txtStatus.getText().toString().equals("conectado")) { readTag(); } else { Toast.makeText(getBaseContext(), "dispositivo " + txtStatus.getText(), Toast.LENGTH_LONG) .show(); } } }); } }
From source file:com.loloof64.android.chess_position_manager.MainActivity.java
@Override protected void onResume() { super.onResume(); IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_MEDIA_REMOVED); filter.addAction(Intent.ACTION_MEDIA_BAD_REMOVAL); filter.addAction(Intent.ACTION_MEDIA_EJECT); filter.addAction(Intent.ACTION_MEDIA_NOFS); filter.addAction(Intent.ACTION_MEDIA_SHARED); filter.addAction(Intent.ACTION_MEDIA_UNMOUNTED); registerReceiver(mStorageReceiver, filter); }
From source file:com.coinblesk.client.CurrentBalanceFragment.java
@Override public void onStart() { super.onStart(); Intent intent = new Intent(getActivity(), WalletService.class); getActivity().bindService(intent, serviceConnection, Context.BIND_AUTO_CREATE); LocalBroadcastManager broadcaster = LocalBroadcastManager.getInstance(getActivity()); IntentFilter balanceFilter = new IntentFilter(Constants.WALLET_BALANCE_CHANGED_ACTION); balanceFilter.addAction(Constants.EXCHANGE_RATE_CHANGED_ACTION); broadcaster.registerReceiver(walletBalanceChangeBroadcastReceiver, balanceFilter); broadcaster.registerReceiver(exchangeRateChangeListener, new IntentFilter(Constants.EXCHANGE_RATE_CHANGED_ACTION)); IntentFilter walletProgressFilter = new IntentFilter(Constants.WALLET_DOWNLOAD_PROGRESS_ACTION); walletProgressFilter.addAction(Constants.WALLET_DOWNLOAD_DONE_ACTION); broadcaster.registerReceiver(walletProgressBroadcastReceiver, walletProgressFilter); IntentFilter filter = new IntentFilter(); filter.addAction(Constants.WALLET_CHANGED_ACTION); filter.addAction(Constants.WALLET_DOWNLOAD_DONE_ACTION); broadcaster.registerReceiver(walletChangedBroadcastReceiver, filter); }
From source file:com.example.dashclock.examplehost.ExampleHostActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main);/* w w w .j a va 2s .c om*/ ListView listView = (ListView) findViewById(R.id.extensions); listView.setOnItemClickListener(this); try { mHost = new Host(); mAdapter = new ExtensionAdapter(this, mHost, this); listView.setAdapter(mAdapter); mAdapter.notifyDataSetChanged(); } catch (SecurityException ex) { Toast.makeText(this, "Not enough permissions", Toast.LENGTH_SHORT).show(); Log.e(TAG, "Not enough permissions", ex); } // Listen for new multiplexer package changes IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_MULTIPLEXER_PACKAGE_CHANGED); LocalBroadcastManager.getInstance(this).registerReceiver(mMultiplexerEventsReceiver, filter); // Set up force world-readability button mOnlyShowingWorldReadableExtensionsView = findViewById(R.id.only_showing_world_readable_view); mOnlyShowingWorldReadableExtensionsView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { try { startActivity(mHost.getEnableForceWorldReadabilityIntent()); } catch (ActivityNotFoundException e) { } } }); }
From source file:com.kentdisplays.synccardboarddemo.MainActivity.java
/** * Sets the view to our CardboardView and initializes the transformation matrices we will use * to render our scene./*from ww w . jav a 2s .c om*/ * @param savedInstanceState */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Intent streamingIntent = new Intent(this, SyncStreamingService.class); startService(streamingIntent); Intent ftpIntent = new Intent(this, SyncFtpService.class); startService(ftpIntent); setContentView(R.layout.activity_main); CardboardView cardboardView = (CardboardView) findViewById(R.id.cardboard_view); cardboardView.setRenderer(this); setCardboardView(cardboardView); mCamera = new float[16]; mView = new float[16]; mModelViewProjection = new float[16]; mModelView = new float[16]; mModelFloor = new float[16]; mHeadView = new float[16]; mOverlayView = (CardboardOverlayView) findViewById(R.id.overlay); mRandom = new Random(); // Set up a local receiver to listen for new saved files. IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(FileDownloadService.SAVED_NEW_FILE); LocalBroadcastManager.getInstance(this).registerReceiver(mMessageReceiver, intentFilter); }
From source file:com.linkbubble.ui.BubbleFlowActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { mDestroyed = false;/* w w w . j a v a 2 s . c om*/ super.onCreate(savedInstanceState); Settings settings = Settings.get(); if (null != settings) { setTheme(settings.getDarkThemeEnabled() ? R.style.ThemeTransparentDark : R.style.ThemeTransparent); } Log.d("TAG", "!!!!! ON CREATE"); mContentViews = new ArrayList<>(); mPreClosedContentViews = new ArrayList<>(); setVisible(false); this.requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.activity_bubble_flow); IntentFilter filter = new IntentFilter(); filter.addAction(ACTIVITY_INTENT_NAME); LocalBroadcastManager bm = LocalBroadcastManager.getInstance(this); bm.registerReceiver(mBroadcastReceiver, filter); MainController controller = getMainController(); if (null != controller && null != controller.mBubbleFlowDraggable) { synchronized (MainApplication.mActivitySharedLock) { MainApplication.mActivitySharedLock.notify(); } if (MainApplication.mMoveWebViewsActivityToBack) { moveTaskToBack(true); } } else { moveTaskToBack(true); mDestroyed = true; finish(); startActivityForResult(new Intent(this, EntryActivity.class), 0); } int canvasMaskHeight = getResources().getDimensionPixelSize(R.dimen.canvas_mask_height); mTopMaskView = new ImageView(this); mTopMaskView.setImageResource(R.drawable.masked_background_half); mTopMaskView.setScaleType(ImageView.ScaleType.FIT_XY); FrameLayout.LayoutParams topMaskLP = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, canvasMaskHeight); topMaskLP.gravity = Gravity.TOP; mTopMaskView.setLayoutParams(topMaskLP); addContentView(mTopMaskView, topMaskLP); }
From source file:com.golden.android.eyecare.ForegroundService.java
@Override public void onCreate() { super.onCreate(); context = getApplicationContext();// w w w . j ava 2s .co m global = (Global) getApplicationContext(); final IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON); filter.addAction(Intent.ACTION_SCREEN_OFF); final BroadcastReceiver screenoffReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) { Log.v("screenoffReceiver", "SCREEN OFF"); onDestroy(); stopForeground(Boolean.TRUE); } return; } }; registerReceiver(screenoffReceiver, filter); }
From source file:hackathon.openrice.CardsActivity.java
@Override protected void onResume() { super.onResume(); if (!isReceiverRegistered) { IntentFilter filter = new IntentFilter(); filter.addAction("com.ours.asyncisover"); filter.addCategory("android.intent.category.DEFAULT"); registerReceiver(myBroadcastReceiver, filter); isReceiverRegistered = true;/*from ww w.j a va2s . c o m*/ } mCardScroller.activate(); }
From source file:com.appdevper.mediaplayer.app.MediaNotificationManager.java
/** * Posts the notification and starts tracking the session to keep it * updated. The notification will automatically be removed if the session is * destroyed before {@link #stopNotification} is called. */// ww w .ja va 2 s .c om public void startNotification() { if (!mStarted) { mMetadata = mController.getMetadata(); mPlaybackState = mController.getPlaybackState(); // The notification must be updated after setting started to true Notification notification = createNotification(); if (notification != null) { mController.registerCallback(mCb); IntentFilter filter = new IntentFilter(); filter.addAction(ACTION_NEXT); filter.addAction(ACTION_PAUSE); filter.addAction(ACTION_PLAY); filter.addAction(ACTION_PREV); filter.addAction(ACTION_STOP_CASTING); mService.registerReceiver(this, filter); mService.startForeground(NOTIFICATION_ID, notification); mStarted = true; } } }
From source file:com.dwdesign.tweetings.fragment.MentionsFragment.java
@Override public void onStart() { super.onStart(); final IntentFilter filter = new IntentFilter(BROADCAST_MENTIONS_REFRESHED); filter.addAction(BROADCAST_ACCOUNT_LIST_DATABASE_UPDATED); filter.addAction(BROADCAST_MENTIONS_DATABASE_UPDATED); filter.addAction(BROADCAST_REFRESHSTATE_CHANGED); registerReceiver(mStatusReceiver, filter); if (getServiceInterface().isMentionsRefreshing()) { setRefreshing(false);//from www . j a va2s . com } else { onRefreshComplete(); } }