List of usage examples for android.content IntentFilter IntentFilter
public IntentFilter(Parcel source)
From source file:com.stikyhive.stikyhive.ChattingActivity.java
@Override protected void onResume() { super.onResume(); Log.i(TAG, " ON RESUME"); int a;//from ww w . jav a2 s .com RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, 0); params.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM); layoutTalk.setLayoutParams(params); layoutTalk.setGravity(Gravity.CENTER); flagRecord = false; // txtUserName = (TextView) findViewById(R.id.txtChatName); LocalBroadcastManager.getInstance(this).registerReceiver(mRegistrationBroadcastReceiver, new IntentFilter(QuickstartPreferences.CHAT_REGISTRATION_COMPLETE)); if (!ChattingActivity.flagChatting) { // Log.i(TAG, " FLag Make Offer"); StikyChat stikyChat = new StikyChat("", messageServer, false, timeSendOffer, "", offerId, offerStatus, price, rate, name, null, ""); //stikyChat.setFlagStikyPayChk(flagStikyPayChk); adapter.add(stikyChat); lv.smoothScrollToPosition(adapter.getCount() - 1); if (offerId != 0) { msg = "Make Offer"; } else { msg = messageServer; } new regTask().execute("Send ... "); } }
From source file:com.moez.QKSMS.mmssms.Transaction.java
/** * @deprecated//ww w. j a va2 s . c o m */ private void revokeWifi(boolean saveState) { WifiManager wifi = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (saveState) { settings.currentWifi = wifi.getConnectionInfo(); settings.currentWifiState = wifi.isWifiEnabled(); wifi.disconnect(); settings.discon = new DisconnectWifi(); context.registerReceiver(settings.discon, new IntentFilter(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)); settings.currentDataState = Utils.isMobileDataEnabled(context); Utils.setMobileDataEnabled(context, true); } else { wifi.disconnect(); wifi.disconnect(); settings.discon = new DisconnectWifi(); context.registerReceiver(settings.discon, new IntentFilter(WifiManager.SUPPLICANT_STATE_CHANGED_ACTION)); Utils.setMobileDataEnabled(context, true); } }
From source file:com.chen.emailsync.SyncManager.java
@SuppressWarnings("deprecation") @Override//from www.j a v a 2 s. c om public void run() { sStop = false; alwaysLog("Service thread running"); TempDirectory.setTempDirectory(this); // Synchronize here to prevent a shutdown from happening while we initialize our observers // and receivers synchronized (sSyncLock) { if (INSTANCE != null) { mResolver = getContentResolver(); // Set up our observers; we need them to know when to start/stop various syncs based // on the insert/delete/update of mailboxes and accounts // We also observe synced messages to trigger upsyncs at the appropriate time mAccountObserver = getAccountObserver(mHandler); mResolver.registerContentObserver(Account.NOTIFIER_URI, true, mAccountObserver); mMailboxObserver = new MailboxObserver(mHandler); mResolver.registerContentObserver(Mailbox.CONTENT_URI, false, mMailboxObserver); mSyncedMessageObserver = new SyncedMessageObserver(mHandler); mResolver.registerContentObserver(Message.SYNCED_CONTENT_URI, true, mSyncedMessageObserver); mConnectivityReceiver = new ConnectivityReceiver(); registerReceiver(mConnectivityReceiver, new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION)); onStartup(); } } try { // Loop indefinitely until we're shut down while (!sStop) { runAwake(EXTRA_MAILBOX_ID); waitForConnectivity(); mNextWaitReason = null; long nextWait = checkMailboxes(); try { synchronized (this) { if (!mKicked) { if (nextWait < 0) { log("Negative wait? Setting to 1s"); nextWait = 1 * SECONDS; } if (nextWait > 10 * SECONDS) { if (mNextWaitReason != null) { log("Next awake " + nextWait / 1000 + "s: " + mNextWaitReason); } runAsleep(EXTRA_MAILBOX_ID, nextWait + (3 * SECONDS)); } wait(nextWait); } } } catch (InterruptedException e) { // Needs to be caught, but causes no problem log("SyncServiceManager interrupted"); } finally { synchronized (this) { if (mKicked) { //log("Wait deferred due to kick"); mKicked = false; } } } } log("Shutdown requested"); } catch (ProviderUnavailableException pue) { // Shutdown cleanly in this case // NOTE: Sync adapters will also crash with this error, but that is already handled // in the adapters themselves, i.e. they return cleanly via done(). When the Email // process starts running again, remote processes will be started again in due course LogUtils.e(TAG, "EmailProvider unavailable; shutting down"); // Ask for our service to be restarted; this should kick-start the Email process as well startService(new Intent(this, SyncManager.class)); } catch (RuntimeException e) { // Crash; this is a completely unexpected runtime error LogUtils.e(TAG, "RuntimeException", e); throw e; } finally { shutdown(); } }