List of usage examples for android.content IntentFilter IntentFilter
public IntentFilter()
From source file:com.mobiletin.inputmethod.indic.LatinIME.java
@Override public void onCreate() { Settings.init(this); DebugFlags.init(PreferenceManager.getDefaultSharedPreferences(this)); RichInputMethodManager.init(this); mRichImm = RichInputMethodManager.getInstance(); SubtypeSwitcher.init(this); KeyboardSwitcher.init(this); AudioAndHapticFeedbackManager.init(this); AccessibilityUtils.init(this); StatsUtils.init(this); checkForTransliteration();// w w w . jav a 2s . c om super.onCreate(); mHandler.onCreate(); DEBUG = DebugFlags.DEBUG_ENABLED; // TODO: Resolve mutual dependencies of {@link #loadSettings()} and {@link #initSuggest()}. loadSettings(); resetSuggest(); // Register to receive ringer mode change and network state change. // Also receive installation and removal of a dictionary pack. final IntentFilter filter = new IntentFilter(); //filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); filter.addAction(AudioManager.RINGER_MODE_CHANGED_ACTION); registerReceiver(mConnectivityAndRingerModeChangeReceiver, filter); final IntentFilter packageFilter = new IntentFilter(); packageFilter.addAction(Intent.ACTION_PACKAGE_ADDED); packageFilter.addAction(Intent.ACTION_PACKAGE_REMOVED); packageFilter.addDataScheme(SCHEME_PACKAGE); registerReceiver(mDictionaryPackInstallReceiver, packageFilter); final IntentFilter newDictFilter = new IntentFilter(); newDictFilter.addAction(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION); registerReceiver(mDictionaryPackInstallReceiver, newDictFilter); final IntentFilter dictDumpFilter = new IntentFilter(); dictDumpFilter.addAction(DictionaryDumpBroadcastReceiver.DICTIONARY_DUMP_INTENT_ACTION); registerReceiver(mDictionaryDumpBroadcastReceiver, dictDumpFilter); DictionaryDecayBroadcastReciever.setUpIntervalAlarmForDictionaryDecaying(this); StatsUtils.onCreate(mSettings.getCurrent()); }
From source file:se.lu.nateko.edca.svc.GeoHelper.java
/** * Start to listen for changes in the storage state, * and report any changes to handleStorageChange. *///from w w w . ja va2 s. c o m private void startWatchingExternalStorage() { Log.d(TAG, "startWatchingExternalStorage() called."); mExternalStorageReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Log.i("TAG", "Storage state changed: " + intent.getData()); updateExternalStorageState(); handleStorageChange(); } }; IntentFilter filter = new IntentFilter(); filter.addAction(Intent.ACTION_MEDIA_MOUNTED); filter.addAction(Intent.ACTION_MEDIA_REMOVED); mService.registerReceiver(mExternalStorageReceiver, filter); updateExternalStorageState(); }
From source file:org.linphone.LinphoneService.java
void addCallListner() { mIncomingCallReceiver = new IncomingCallReceiver(); IntentFilter mIntentFilter = new IntentFilter(); // /*from w w w . j a va 2 s . c o m*/ mIntentFilter.addAction("android.intent.action.PHONE_STATE"); mIntentFilter.setPriority(1000); // // mIntentFilter.addAction("android.provider.Telephony.SMS_RECEIVED"); // BroadcastReceiver registerReceiver(mIncomingCallReceiver, mIntentFilter); mAudioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE); // endcall TelephonyManager mTelephonyManager = (TelephonyManager) getSystemService(Context.TELEPHONY_SERVICE); try { Method getITelephonyMethod = TelephonyManager.class.getDeclaredMethod("getITelephony", (Class[]) null); getITelephonyMethod.setAccessible(true); // mITelephony = (ITelephony) getITelephonyMethod.invoke(mTelephonyManager, (Object[]) null); } catch (Exception e) { e.printStackTrace(); } }
From source file:com.anyonavinfo.commonuserregister.MainActivity.java
/** * //from w w w. ja va 2 s . c o m */ private void registerReceiver() { checkReceiver = new CheckReceiver(); IntentFilter messageFilter = new IntentFilter(); messageFilter.addAction(CommonData.MESSAGE_NAME_NULL); messageFilter.addAction(CommonData.MESSAGE_NAME_WRONG); messageFilter.addAction(CommonData.MESSAGE_MOBILE_NULL); messageFilter.addAction(CommonData.MESSAGE_MOBILE_WRONG); messageFilter.addAction(CommonData.MESSAGE_4S_NULL); messageFilter.addAction(CommonData.MESSAGE_VIN_NULL); messageFilter.addAction(CommonData.MESSAGE_VIN_WRONG); messageFilter.addAction(CommonData.MESSAGE_BIRTHDAY_NULL); messageFilter.addAction(CommonData.MESSAGE_EMAIL_NULL); messageFilter.addAction(CommonData.MESSAGE_EMAIL_WRONG); messageFilter.addAction(CommonData.MESSAGE_NICK_WRONG); messageFilter.addAction(CommonData.MESSAGE_NICK_NULL); messageFilter.addAction(CommonData.MESSAGE_TYPE_NULL); registerReceiver(checkReceiver, messageFilter); }
From source file:com.dwdesign.tweetings.fragment.StatusFragment.java
@Override public void onStart() { super.onStart(); final IntentFilter filter = new IntentFilter(); filter.addAction(BROADCAST_FRIENDSHIP_CHANGED); filter.addAction(BROADCAST_FAVORITE_CHANGED); filter.addAction(BROADCAST_RETWEET_CHANGED); filter.addAction(BROADCAST_TWITLONGER_EXPANDED); registerReceiver(mStatusReceiver, filter); if (mStatus != null) { displayStatus(mStatus);// w w w .j av a2s . c o m } else { getStatus(false); } updateUserColor(); }
From source file:cw.kop.autobackground.sources.SourceListFragment.java
@Override public void onResume() { super.onResume(); sourceList.setOnItemClickListener(this); new ImageCountTask().execute(); IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(FileHandler.DOWNLOAD_TERMINATED); intentFilter.addAction(ADD_ENTRY);/* ww w. j a va2 s . co m*/ intentFilter.addAction(SET_ENTRY); LocalBroadcastManager.getInstance(appContext).registerReceiver(sourceListReceiver, intentFilter); if (isServiceRunning(LiveWallpaperService.class.getName())) { setButton.setVisibility(View.GONE); } else { setButton.setVisibility(View.VISIBLE); } }
From source file:com.allwinner.theatreplayer.launcher.activity.LaunchActivity.java
private void registerHomeKeyEventReceiver() { IntentFilter HomeKeyfilter = new IntentFilter(); HomeKeyfilter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); registerReceiver(mHomeKeyEventReceiver, HomeKeyfilter); }
From source file:com.moez.QKSMS.mmssms.Transaction.java
private void sendMMS(final byte[] bytesToSend) { revokeWifi(true);/*from ww w . j av a2s.co m*/ // enable mms connection to mobile data mConnMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE); int result = beginMmsConnectivity(); if (LOCAL_LOGV) Log.v(TAG, "result of connectivity: " + result + " "); if (result != 0) { // if mms feature is not already running (most likely isn't...) then register a receiver and wait for it to be active IntentFilter filter = new IntentFilter(); filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); final BroadcastReceiver receiver = new BroadcastReceiver() { @Override public void onReceive(Context context1, Intent intent) { String action = intent.getAction(); if (!action.equals(ConnectivityManager.CONNECTIVITY_ACTION)) { return; } @SuppressWarnings("deprecation") NetworkInfo mNetworkInfo = intent.getParcelableExtra(ConnectivityManager.EXTRA_NETWORK_INFO); if ((mNetworkInfo == null) || (mNetworkInfo.getType() != ConnectivityManager.TYPE_MOBILE)) { return; } if (!mNetworkInfo.isConnected()) { return; } else { // ready to send the message now if (LOCAL_LOGV) Log.v(TAG, "sending through broadcast receiver"); alreadySending = true; sendData(bytesToSend); context.unregisterReceiver(this); } } }; context.registerReceiver(receiver, filter); try { Looper.prepare(); } catch (Exception e) { // Already on UI thread probably } // try sending after 3 seconds anyways if for some reason the receiver doesn't work new Handler().postDelayed(new Runnable() { @Override public void run() { if (!alreadySending) { try { if (LOCAL_LOGV) Log.v(TAG, "sending through handler"); context.unregisterReceiver(receiver); } catch (Exception e) { } sendData(bytesToSend); } } }, 7000); } else { // mms connection already active, so send the message if (LOCAL_LOGV) Log.v(TAG, "sending right away, already ready"); sendData(bytesToSend); } }
From source file:com.allwinner.theatreplayer.launcher.activity.LaunchActivity.java
private void registerAppBroadcastReceiver() { IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(UpdateService.APKDOWNSUC); intentFilter.addAction(UpdateService.APKONCHECKED); intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE"); registerReceiver(mAppBroadcastReceiver, intentFilter); }
From source file:hochschuledarmstadt.photostream_tools.PhotoStreamClientImpl.java
private void registerInternetAvailableBroadcastReceiver() { try {//from w ww . j ava 2 s. com IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(INTENT_CONNECTIVITY_CHANGE); context.registerReceiver(internetAvailableBroadcastReceiver, intentFilter); } catch (Exception e) { } }