List of usage examples for android.content IntentFilter addAction
public final void addAction(String action)
From source file:com.achep.acdisplay.services.activemode.ActiveModeService.java
@Override public void onCreate() { Context context = getContext(); mListeningAtom = new Atomic(this, TAG); mSensors = buildAvailableSensorsList(context); mHandlers = new ActiveModeHandler[] { new ScreenHandler(context, this), new InactiveTimeHandler(context, this), new WithoutNotifiesHandler(context, this), }; for (ActiveModeHandler handler : mHandlers) { handler.create();//from ww w . j a v a 2 s. c o m } requestActive(); IntentFilter filter = new IntentFilter(); filter.addAction(App.ACTION_INTERNAL_PING_SENSORS); LocalBroadcastManager.getInstance(context).registerReceiver(mLocalReceiver, filter); NotificationPresenter.getInstance().registerListener(this); }
From source file:com.android.managedprovisioning.DeviceOwnerProvisioningActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); if (DEBUG)/* w w w .ja v a 2s . c o m*/ ProvisionLogger.logd("Device owner provisioning activity ONCREATE"); if (savedInstanceState != null) { mCancelDialogShown = savedInstanceState.getBoolean(KEY_CANCEL_DIALOG_SHOWN, false); mPendingProvisioningIntents = savedInstanceState.getParcelableArrayList(KEY_PENDING_INTENTS); } // Setup the UI. initializeLayoutParams(R.layout.progress, R.string.setup_work_device, true); configureNavigationButtons(NEXT_BUTTON_EMPTY_LABEL, View.INVISIBLE, View.VISIBLE); setTitle(R.string.setup_device_progress); mProgressTextView = (TextView) findViewById(R.id.prog_text); if (mCancelDialogShown) showCancelResetDialog(); // Setup broadcast receiver for feedback from service. mServiceMessageReceiver = new ServiceMessageReceiver(); IntentFilter filter = new IntentFilter(); filter.addAction(DeviceOwnerProvisioningService.ACTION_PROVISIONING_SUCCESS); filter.addAction(DeviceOwnerProvisioningService.ACTION_PROVISIONING_ERROR); filter.addAction(DeviceOwnerProvisioningService.ACTION_PROGRESS_UPDATE); LocalBroadcastManager.getInstance(this).registerReceiver(mServiceMessageReceiver, filter); // Load the ProvisioningParams (from message in Intent). mParams = (ProvisioningParams) getIntent().getParcelableExtra(ProvisioningParams.EXTRA_PROVISIONING_PARAMS); if (mParams != null) { maybeSetLogoAndMainColor(mParams.mainColor); } startDeviceOwnerProvisioningService(); }
From source file:com.chao.facebookzc.UiLifecycleHelper.java
/** * To be called from an Activity or Fragment's onResume method. *//* www . j a v a 2 s . co m*/ public void onResume() { Session session = Session.getActiveSession(); if (session != null) { if (callback != null) { session.addCallback(callback); } if (SessionState.CREATED_TOKEN_LOADED.equals(session.getState())) { session.openForRead(null); } } // add the broadcast receiver IntentFilter filter = new IntentFilter(); filter.addAction(Session.ACTION_ACTIVE_SESSION_SET); filter.addAction(Session.ACTION_ACTIVE_SESSION_UNSET); // Add a broadcast receiver to listen to when the active Session // is set or unset, and add/remove our callback as appropriate broadcastManager.registerReceiver(receiver, filter); }
From source file:com.kryten2k35.otaupdater.activities.AvailableActivity.java
@Override protected void onStart() { super.onStart(); IntentFilter filter = new IntentFilter(); filter.addAction(MD5_CHECK); filter.addAction(DOWNLOAD_CANCELLED); filter.addAction(DOWNLOAD_FINISHED); filter.addAction(DOWNLOAD_PROGRESS); mContext.registerReceiver(mReceiver, filter); }
From source file:aenadon.wienerlinienalarm.activities.MainActivity.java
private void setupAlarmTriggeredReceiver() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Keys.Intent.REFRESH_LIST); alarmTriggeredReceiver = new BroadcastReceiver() { @Override//from ww w.j av a 2 s. c o m public void onReceive(Context context, Intent intent) { tabAdapter.notifyDataSetChanged(); } }; registerReceiver(alarmTriggeredReceiver, intentFilter); }
From source file:com.javadog.cgeowear.cgeoWearService.java
/** * Registers the service's BroadcastReceivers to listen for updates from the phone app (location, direction, etc.) *//* w w w .j av a2s . c o m*/ private void listenForUpdates() { localBroadcastManager = LocalBroadcastManager.getInstance(getApplicationContext()); IntentFilter updateFilter = new IntentFilter(); updateFilter.addAction(ListenerService.PATH_UPDATE_DISTANCE); updateFilter.addAction(ListenerService.PATH_UPDATE_DIRECTION); updateFilter.addAction(ListenerService.PATH_UPDATE_LOCATION); updateFilter.addAction(ListenerService.PATH_KILL_APP); localBroadcastManager.registerReceiver(localBroadcastReceiver, updateFilter); IntentFilter bcrFilter = new IntentFilter(); bcrFilter.addAction(ListenerService.PATH_KILL_APP); registerReceiver(broadcastReceiver, bcrFilter); }
From source file:com.ai.ui.partybuild.message.HyphenateMainActivity.java
private void registerBroadcastReceiver() { broadcastManager = LocalBroadcastManager.getInstance(this); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(Constant.ACTION_CONTACT_CHANAGED); intentFilter.addAction(Constant.ACTION_GROUP_CHANAGED); broadcastReceiver = new BroadcastReceiver() { @Override//from w ww. j a va 2 s . c o m public void onReceive(Context context, Intent intent) { updateUnreadLabel(); if (currentTabIndex == 0) { // refresh conversation list if (conversationListFragment != null) { conversationListFragment.refresh(); } } String action = intent.getAction(); if (action.equals(Constant.ACTION_GROUP_CHANAGED)) { GroupFragment.instance.onResume(); } } }; broadcastManager.registerReceiver(broadcastReceiver, intentFilter); }
From source file:com.hichinaschool.flashcards.anki.StudyOptionsActivity.java
/** * Show/dismiss dialog when sd card is ejected/remounted (collection is saved by SdCardReceiver) *//*from w ww .ja v a 2 s.c o m*/ private void registerExternalStorageListener() { if (mUnmountReceiver == null) { mUnmountReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { if (intent.getAction().equals(SdCardReceiver.MEDIA_EJECT)) { mNotMountedDialog = StyledOpenCollectionDialog.show(StudyOptionsActivity.this, getResources().getString(R.string.sd_card_not_mounted), new OnCancelListener() { @Override public void onCancel(DialogInterface arg0) { finish(); } }); } else if (intent.getAction().equals(SdCardReceiver.MEDIA_MOUNT)) { if (mNotMountedDialog != null && mNotMountedDialog.isShowing()) { mNotMountedDialog.dismiss(); } mCurrentFragment.reloadCollection(); } } }; IntentFilter iFilter = new IntentFilter(); iFilter.addAction(SdCardReceiver.MEDIA_EJECT); iFilter.addAction(SdCardReceiver.MEDIA_MOUNT); registerReceiver(mUnmountReceiver, iFilter); } }
From source file:com.acrr.acdisplay.services.activemode.ActiveModeService.java
@Override public void onCreate() { Context context = getContext(); mSensors = buildAvailableSensorsList(context); super.onCreate(); IntentFilter filter = new IntentFilter(); filter.addAction(App.ACTION_INTERNAL_PING_SENSORS); LocalBroadcastManager.getInstance(context).registerReceiver(mLocalReceiver, filter); NotificationPresenter.getInstance().registerListener(this); }
From source file:com.example.ireviewr.MainActivity.java
@Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); //da postavi naziv korisnika setUpUserName();//from www. j a v a 2 s . c o m //Za slucaj da referenca nije postavljena da se izbegne problem sa androidom! if (manager == null) { setUpReceiver(); } if (allowSync) { int interval = ReviewerTools.calculateTimeTillNextSync(Integer.parseInt(synctime)); manager.setRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), interval, pendingIntent); //Toast.makeText(this, "Alarm Set", Toast.LENGTH_SHORT).show(); } IntentFilter filter = new IntentFilter(); filter.addAction(NEW_COMMENTS); filter.addAction(SYNC_DATA); registerReceiver(sync, filter); }