Java Code Examples for android.content.IntentFilter

The following code examples are extracted from open source projects. You can click to vote up the examples that are useful to you.

Example 1

From project ActionBarSherlock, under directory /samples/fragments/src/com/actionbarsherlock/sample/fragments/.

Source file: LoaderCustomSupport.java

  18 
vote

public PackageIntentReceiver(AppListLoader loader){
  mLoader=loader;
  IntentFilter filter=new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
  filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
  filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
  filter.addDataScheme("package");
  mLoader.getContext().registerReceiver(this,filter);
  IntentFilter sdFilter=new IntentFilter();
  sdFilter.addAction(IntentCompat.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
  sdFilter.addAction(IntentCompat.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
  mLoader.getContext().registerReceiver(this,sdFilter);
}
 

Example 2

From project adg-android, under directory /src/com/analysedesgeeks/android/.

Source file: AbstractPodcastActivity.java

  18 
vote

@Override public void onStart(){
  super.onStart();
  paused=false;
  mToken=MusicUtils.bindToService(this,osc);
  if (mToken == null) {
    mHandler.sendEmptyMessage(QUIT);
  }
  final IntentFilter f=new IntentFilter();
  f.addAction(PodcastPlaybackService.PLAYSTATE_CHANGED);
  updateTrackInfo();
  final long next=refreshNow();
  queueNextRefresh(next);
}
 

Example 3

From project Android-automation, under directory /Tmts_Java/src/com/taobao/tmts/framework/utils/.

Source file: ActivityUtils.java

  18 
vote

/** 
 * This is were the activityMonitor is set up. The monitor will keep check for the currently active activity.
 */
private void setupActivityMonitor(){
  try {
    IntentFilter filter=null;
    activityMonitor=inst.addMonitor(filter,null,false);
  }
 catch (  Exception e) {
    e.printStackTrace();
  }
}
 

Example 4

From project Android-Battery-Widget, under directory /src/com/em/batterywidget/.

Source file: BatteryUpdateService.java

  18 
vote

private void registerNewReceiver(){
  mBatteryReceiver=new BatteryReceiver();
  IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(Intent.ACTION_BATTERY_CHANGED);
  intentFilter.addAction(Intent.ACTION_BATTERY_LOW);
  registerReceiver(mBatteryReceiver,intentFilter);
}
 

Example 5

From project android-context, under directory /src/edu/fsu/cs/contextprovider/.

Source file: ContextService.java

  18 
vote

private void startService(){
  startMonitors();
  prefs.registerOnSharedPreferenceChangeListener(this);
  IntentFilter storeFilter=new IntentFilter();
  storeFilter.addAction(ContextConstants.CONTEXT_STORE_INTENT);
  registerReceiver(contextIntentReceiver,storeFilter);
  IntentFilter restartFilter=new IntentFilter();
  restartFilter.addAction(ContextConstants.CONTEXT_RESTART_INTENT);
  registerReceiver(restartIntentReceiver,restartFilter);
}
 

Example 6

From project android-tether, under directory /src/og/android/tether/.

Source file: ConnectActivity.java

  18 
vote

@Override public void onResume(){
  Log.d(TAG,"onResume()");
  super.onResume();
  IntentFilter i=new IntentFilter(FBManager.MESSAGE_FB_CONNECTED);
  registerReceiver(mReceiver,i);
  ((TetherApplication)getApplication()).statConnectActivity();
}
 

Example 7

From project android-thaiime, under directory /common/src/com/android/common/.

Source file: NetworkConnectivityListener.java

  18 
vote

/** 
 * This method starts listening for network connectivity state changes.
 * @param context
 */
public synchronized void startListening(Context context){
  if (!mListening) {
    mContext=context;
    IntentFilter filter=new IntentFilter();
    filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    context.registerReceiver(mReceiver,filter);
    mListening=true;
  }
}
 

Example 8

From project androidpn, under directory /androidpn-client/src/org/androidpn/client/.

Source file: NotificationService.java

  18 
vote

private void registerNotificationReceiver(){
  IntentFilter filter=new IntentFilter();
  filter.addAction(Constants.ACTION_SHOW_NOTIFICATION);
  filter.addAction(Constants.ACTION_NOTIFICATION_CLICKED);
  filter.addAction(Constants.ACTION_NOTIFICATION_CLEARED);
  registerReceiver(notificationReceiver,filter);
}
 

Example 9

From project android_aosp_packages_apps_Settings, under directory /src/com/android/settings/applications/.

Source file: ApplicationsState.java

  18 
vote

void registerReceiver(){
  IntentFilter filter=new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
  filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
  filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
  filter.addDataScheme("package");
  mContext.registerReceiver(this,filter);
  IntentFilter sdFilter=new IntentFilter();
  sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
  sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
  mContext.registerReceiver(this,sdFilter);
}
 

Example 10

From project android_device_samsung_galaxys2, under directory /tvout/src/com/teamhacksung/tvout/.

Source file: TvOutService.java

  18 
vote

@Override public void onCreate(){
  IntentFilter filter=new IntentFilter(Intent.ACTION_HDMI_AUDIO_PLUG);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(Intent.ACTION_SCREEN_ON);
  registerReceiver(mReceiver,filter);
  Log.i(TAG,"Registered Receiver");
}
 

Example 11

From project android_device_samsung_galaxys2_1, under directory /tvout/src/com/teamhacksung/tvout/.

Source file: TvOutService.java

  18 
vote

@Override public void onCreate(){
  IntentFilter filter=new IntentFilter(Intent.ACTION_HDMI_AUDIO_PLUG);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(Intent.ACTION_SCREEN_ON);
  registerReceiver(mReceiver,filter);
  Log.i(TAG,"Registered Receiver");
}
 

Example 12

From project android_device_samsung_i777, under directory /tvout/src/com/teamhacksung/tvout/.

Source file: TvOutService.java

  18 
vote

@Override public void onCreate(){
  IntentFilter filter=new IntentFilter(Intent.ACTION_HDMI_AUDIO_PLUG);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(Intent.ACTION_SCREEN_ON);
  registerReceiver(mReceiver,filter);
  Log.i(TAG,"Registered Receiver");
}
 

Example 13

From project android_frameworks_ex, under directory /common/java/com/android/common/.

Source file: NetworkConnectivityListener.java

  18 
vote

/** 
 * This method starts listening for network connectivity state changes.
 * @param context
 */
public synchronized void startListening(Context context){
  if (!mListening) {
    mContext=context;
    IntentFilter filter=new IntentFilter();
    filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
    context.registerReceiver(mReceiver,filter);
    mListening=true;
  }
}
 

Example 14

From project android_packages_apps_Gallery, under directory /src/com/android/camera/.

Source file: Camera.java

  18 
vote

private void installIntentFilter(){
  IntentFilter intentFilter=new IntentFilter(Intent.ACTION_MEDIA_MOUNTED);
  intentFilter.addAction(Intent.ACTION_MEDIA_UNMOUNTED);
  intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_STARTED);
  intentFilter.addAction(Intent.ACTION_MEDIA_SCANNER_FINISHED);
  intentFilter.addAction(Intent.ACTION_MEDIA_CHECKING);
  intentFilter.addDataScheme("file");
  registerReceiver(mReceiver,intentFilter);
  mDidRegister=true;
}
 

Example 15

From project android_packages_apps_Gallery2, under directory /src/com/android/gallery3d/data/.

Source file: MtpClient.java

  18 
vote

/** 
 * MtpClient constructor
 * @param context the {@link android.content.Context} to use for the MtpClient
 */
public MtpClient(Context context){
  mContext=context;
  mUsbManager=(UsbManager)context.getSystemService(Context.USB_SERVICE);
  mPermissionIntent=PendingIntent.getBroadcast(mContext,0,new Intent(ACTION_USB_PERMISSION),0);
  IntentFilter filter=new IntentFilter();
  filter.addAction(UsbManager.ACTION_USB_DEVICE_ATTACHED);
  filter.addAction(UsbManager.ACTION_USB_DEVICE_DETACHED);
  filter.addAction(ACTION_USB_PERMISSION);
  context.registerReceiver(mUsbReceiver,filter);
}
 

Example 16

From project android_packages_apps_phone, under directory /src/com/android/phone/.

Source file: BluetoothHandsfree.java

  18 
vote

private BluetoothPhoneState(){
  updateServiceState(false,mCM.getDefaultPhone().getServiceState());
  handlePreciseCallStateChange(false,null);
  mBattchg=5;
  mSignal=asuToSignal(mCM.getDefaultPhone().getSignalStrength());
  mCM.getDefaultPhone().registerForServiceStateChanged(mStateChangeHandler,SERVICE_STATE_CHANGED,null);
  mCM.registerForPreciseCallStateChanged(mStateChangeHandler,PRECISE_CALL_STATE_CHANGED,null);
  mCM.registerForCallWaiting(mStateChangeHandler,PHONE_CDMA_CALL_WAITING,null);
  IntentFilter filter=new IntentFilter(Intent.ACTION_BATTERY_CHANGED);
  filter.addAction(TelephonyIntents.ACTION_SIGNAL_STRENGTH_CHANGED);
  filter.addAction(BluetoothA2dp.ACTION_SINK_STATE_CHANGED);
  mContext.registerReceiver(mStateReceiver,filter);
}
 

Example 17

From project Anki-Android, under directory /src/com/ichi2/veecheck/.

Source file: CheckService.java

  18 
vote

@Override protected VeecheckNotifier createNotifier(){
  IntentFilter[] filters=new IntentFilter[1];
  IntentFilter filter=new IntentFilter(Intent.ACTION_VIEW);
  filter.addDataScheme("http");
  filters[0]=filter;
  return new DefaultNotifier(this,NOTIFICATION_ID,filters,new Intent(this,Notification.class),R.drawable.anki,R.string.notify_ticker,R.string.notify_title,R.string.notify_message);
}
 

Example 18

From project AnySoftKeyboard, under directory /src/com/anysoftkeyboard/receivers/.

Source file: PackagesChangedReceiver.java

  18 
vote

public IntentFilter createFilterToRegisterOn(){
  IntentFilter filter=new IntentFilter();
  filter.addCategory(Intent.CATEGORY_DEFAULT);
  filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
  filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
  filter.addAction(Intent.ACTION_PACKAGE_ADDED);
  filter.addAction(Intent.ACTION_PACKAGE_REPLACED);
  filter.addDataScheme("package");
  return filter;
}
 

Example 19

From project AquaNotesTest, under directory /src/com/google/android/apps/iosched/ui/.

Source file: ScheduleFragment.java

  18 
vote

@Override public void onResume(){
  super.onResume();
  requery();
  getActivity().getContentResolver().registerContentObserver(ScheduleContract.Sessions.CONTENT_URI,true,mSessionChangesObserver);
  final IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_TIME_TICK);
  filter.addAction(Intent.ACTION_TIME_CHANGED);
  filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
  getActivity().registerReceiver(mReceiver,filter,null,new Handler());
}
 

Example 20

From project Backyard-Brains-Android-App, under directory /src/com/backyardbrains/audio/.

Source file: AudioService.java

  18 
vote

/** 
 * Toggle our receiver. If true, register a receiver for intents with the action "BYBToggleRecording", otherwise, unregister the same receiver.
 * @param reg register if true, unregister otherwise.
 */
private void registerRecordingToggleReceiver(boolean reg){
  if (reg) {
    IntentFilter intentFilter=new IntentFilter("BYBToggleRecording");
    toggleRecorder=new ToggleRecordingListener();
    registerReceiver(toggleRecorder,intentFilter);
  }
 else {
    unregisterReceiver(toggleRecorder);
  }
}
 

Example 21

From project Cafe, under directory /testservice/src/com/baidu/cafe/remote/.

Source file: BatteryState.java

  18 
vote

public void init(){
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_BATTERY_CHANGED);
  mContext.registerReceiver(mBroadcastReceiver,filter);
  try {
    Thread.sleep(5);
  }
 catch (  InterruptedException e) {
  }
}
 

Example 22

From project conference-mobile-app, under directory /android-app/src/com/google/android/apps/iosched/ui/.

Source file: ScheduleFragment.java

  18 
vote

@Override public void onResume(){
  super.onResume();
  requery();
  getActivity().getContentResolver().registerContentObserver(ScheduleContract.Sessions.CONTENT_URI,true,mSessionChangesObserver);
  final IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_TIME_TICK);
  filter.addAction(Intent.ACTION_TIME_CHANGED);
  filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
  getActivity().registerReceiver(mReceiver,filter,null,new Handler());
}
 

Example 23

From project connectbot, under directory /src/sk/vx/connectbot/service/.

Source file: ConnectivityReceiver.java

  18 
vote

public ConnectivityReceiver(TerminalManager manager,boolean lockingWifi){
  mTerminalManager=manager;
  final ConnectivityManager cm=(ConnectivityManager)manager.getSystemService(Context.CONNECTIVITY_SERVICE);
  final WifiManager wm=(WifiManager)manager.getSystemService(Context.WIFI_SERVICE);
  mWifiLock=wm.createWifiLock(TAG);
  final NetworkInfo info=cm.getActiveNetworkInfo();
  if (info != null) {
    mIsConnected=(info.getState() == State.CONNECTED);
  }
  mLockingWifi=lockingWifi;
  final IntentFilter filter=new IntentFilter();
  filter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
  manager.registerReceiver(this,filter);
}
 

Example 24

From project cornerstone, under directory /packages/apps/CSLauncher/src/com/onskreen/cornerstone/launcher/.

Source file: CSLauncher.java

  18 
vote

/** 
 * Registers various intent receivers. The current implementation registers only a wallpaper intent receiver to let other applications change the wallpaper.
 */
private void registerIntentReceivers(){
  IntentFilter filter=new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
  registerReceiver(mWallpaperReceiver,filter);
  filter=new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
  filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
  filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
  filter.addDataScheme("package");
  registerReceiver(mApplicationsReceiver,filter);
}
 

Example 25

From project creamed_glacier_app_settings, under directory /src/com/android/settings/applications/.

Source file: ApplicationsState.java

  18 
vote

void registerReceiver(){
  IntentFilter filter=new IntentFilter(Intent.ACTION_PACKAGE_ADDED);
  filter.addAction(Intent.ACTION_PACKAGE_REMOVED);
  filter.addAction(Intent.ACTION_PACKAGE_CHANGED);
  filter.addDataScheme("package");
  mContext.registerReceiver(this,filter);
  IntentFilter sdFilter=new IntentFilter();
  sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_AVAILABLE);
  sdFilter.addAction(Intent.ACTION_EXTERNAL_APPLICATIONS_UNAVAILABLE);
  mContext.registerReceiver(this,sdFilter);
}
 

Example 26

From project cw-advandroid, under directory /Broadcast/Ordered/src/com/commonsware/android/ordered/.

Source file: OrderedActivity.java

  18 
vote

@Override public void onResume(){
  super.onResume();
  IntentFilter filter=new IntentFilter(NoticeService.BROADCAST);
  filter.setPriority(2);
  registerReceiver(onNotice,filter);
}
 

Example 27

From project cw-omnibus, under directory /EmPubLite/T16-Update/src/com/commonsware/empublite/.

Source file: EmPubLiteActivity.java

  18 
vote

@Override public void onResume(){
  super.onResume();
  if (prefs != null) {
    pager.setKeepScreenOn(prefs.getBoolean(PREF_KEEP_SCREEN_ON,false));
  }
  IntentFilter f=new IntentFilter(DownloadInstallService.ACTION_UPDATE_READY);
  f.setPriority(1000);
  registerReceiver(onUpdate,f);
}
 

Example 28

From project dcnyc10-android, under directory /android/src/com/lullabot/android/apps/iosched/ui/.

Source file: ScheduleFragment.java

  18 
vote

@Override public void onResume(){
  super.onResume();
  requery();
  getActivity().getContentResolver().registerContentObserver(ScheduleContract.Sessions.CONTENT_URI,true,mSessionChangesObserver);
  final IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_TIME_TICK);
  filter.addAction(Intent.ACTION_TIME_CHANGED);
  filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
  getActivity().registerReceiver(mReceiver,filter,null,new Handler());
}
 

Example 29

From project device_samsung_galaxys2, under directory /tvout/src/com/teamhacksung/tvout/.

Source file: TvOutService.java

  18 
vote

@Override public void onCreate(){
  IntentFilter filter=new IntentFilter(Intent.ACTION_HDMI_AUDIO_PLUG);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(Intent.ACTION_SCREEN_ON);
  registerReceiver(mReceiver,filter);
  Log.i(TAG,"Registered Receiver");
}
 

Example 30

From project device_samsung_galaxys2_1, under directory /tvout/src/com/teamhacksung/tvout/.

Source file: TvOutService.java

  18 
vote

@Override public void onCreate(){
  IntentFilter filter=new IntentFilter(Intent.ACTION_HDMI_AUDIO_PLUG);
  filter.addAction(Intent.ACTION_SCREEN_OFF);
  filter.addAction(Intent.ACTION_SCREEN_ON);
  registerReceiver(mReceiver,filter);
  Log.i(TAG,"Registered Receiver");
}
 

Example 31

From project devoxx-france-android-in-fine, under directory /src/com/infine/android/devoxx/ui/.

Source file: ScheduleFragment.java

  18 
vote

@Override public void onResume(){
  super.onResume();
  requery();
  getActivity().getContentResolver().registerContentObserver(ScheduleContract.Sessions.CONTENT_URI,true,mSessionChangesObserver);
  final IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_TIME_TICK);
  filter.addAction(Intent.ACTION_TIME_CHANGED);
  filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
  getActivity().registerReceiver(mReceiver,filter,null,new Handler());
}
 

Example 32

From project DigitbooksExamples, under directory /DigitbooksExamples/src/fr/digitbooks/android/examples/chapitre02/.

Source file: ClockActivity.java

  18 
vote

@Override protected void onResume(){
  super.onResume();
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_TIME_TICK);
  registerReceiver(mIntentReceiver,filter);
  updateTime();
}
 

Example 33

From project 2Degrees-Toolbox, under directory /Toolbox/src/biz/shadowservices/DegreesToolbox/.

Source file: MainActivity.java

  17 
vote

@Override public void onResume(){
  super.onResume();
  SharedPreferences sp=PreferenceManager.getDefaultSharedPreferences(this);
  String username=sp.getString("username","");
  String password=sp.getString("password","");
  if (username.equals("") || password.equals("")) {
    Toast.makeText(this,"Username or password empty",3);
    startActivityForResult(new Intent(this,SetupWizard.class),1);
  }
  refreshData();
  reciever=new UpdateReciever(this);
  registerReceiver(reciever,new IntentFilter(UpdateWidgetService.NEWDATA));
}
 

Example 34

From project agit, under directory /agit/src/main/java/com/madgag/agit/.

Source file: RepositoryViewerActivity.java

  17 
vote

@Override protected void onResume(){
  super.onResume();
  registerReceiver(operationProgressBroadcastReceiver,new IntentFilter("org.openintents.git.operation.progress" + ".update"));
  registerReceiver(repoStateChangeBroadcastReceiver,new IntentFilter(actionWithSuffix(REPO_STATE_CHANGED_BROADCAST)));
  updateUI();
}
 

Example 35

From project AirCastingAndroidClient, under directory /src/main/java/pl/llp/aircasting/activity/.

Source file: SessionsActivity.java

  17 
vote

@Override protected void onResume(){
  super.onResume();
  refreshList();
  refreshTopBar();
  IntentFilter filter=new IntentFilter();
  filter.addAction(Intents.ACTION_SYNC_UPDATE);
  registerReceiver(broadcastReceiver,filter);
  registerReceiver(syncBroadcastReceiver,SyncBroadcastReceiver.INTENT_FILTER);
  eventBus.register(this);
  topBar.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Intent intent=new Intent(SessionsActivity.this,ThresholdsActivity.class);
      intent.putExtra(Intents.EXTRA_SENSOR,selectedSensor);
      startActivity(intent);
    }
  }
);
  syncSummary.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View v){
      Intents.triggerSync(SessionsActivity.this);
    }
  }
);
}
 

Example 36

From project Airports, under directory /src/com/nadmm/airports/notams/.

Source file: NotamFragmentBase.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  mFilter=new IntentFilter();
  mFilter.addAction(NotamService.ACTION_GET_NOTAM);
  mReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      handleNotamBroadcast(intent);
    }
  }
;
}
 

Example 37

From project alljoyn_java, under directory /ice/org/alljoyn/bus/alljoyn/.

Source file: DaemonInit.java

  17 
vote

/** 
 * Initialize daemon service if needed. First it checks whether any daemon is running; if no daemon is running, then it starts the APK daemon if it is installed; If no APK daemon is installed, then starts the bundled daemon. This is a blocking call; it blocks until the daemon is ready or no daemon is found. Thus only non-UI thread is allowed to call PrepareDaemon().
 * @param context The application context
 * @return true  if the daemon is ready for connectionfalse if no daemon is available
 */
public static boolean PrepareDaemon(Context context){
  sContext=context.getApplicationContext();
  Log.v(TAG,"Saved Application Context");
  alljoynAndroidExt=new AllJoynAndroidExt(sContext);
  if (receiver == null) {
    receiver=new ScanResultsReceiver(alljoynAndroidExt);
    sContext.registerReceiver(receiver,new IntentFilter(WifiManager.SCAN_RESULTS_AVAILABLE_ACTION));
  }
  return true;
}
 

Example 38

From project android-api-demos, under directory /src/com/mobeelizer/demos/activities/.

Source file: BaseActivity.java

  17 
vote

/** 
 * {@inheritDoc}
 */
@Override protected void onResume(){
  ApplicationStatus.activityResumed(this);
  registerReceiver(mHandleMessageReceiver,new IntentFilter(DISPLAY_PUSH_MESSAGE_ACTION));
  super.onResume();
  mUserType=UserType.valueOf(mSharedPrefs.getString(USER_TYPE,"A"));
  if (mUserButton != null) {
    setUserType();
  }
}
 

Example 39

From project android-client_1, under directory /src/com/buddycloud/.

Source file: BuddycloudService.java

  17 
vote

/** 
 * Create a new buddycloud service, initialize the required platform listeners.
 */
@Override public void onCreate(){
  super.onCreate();
  Log.d(TAG,"onCreate");
  cellListener=new CellListener(this);
  networkListener=new NetworkListener(this);
  cellListener.start();
  getApplicationContext().registerReceiver(new TimeBroadcastReceiver(this),new IntentFilter("android.intent.action.TIME_TICK"));
}
 

Example 40

From project Android-File-Manager-Tablet, under directory /src/com/nexes/manager/tablet/.

Source file: BluetoothActivity.java

  17 
vote

@Override public void onClick(View v){
  int id=v.getId();
switch (id) {
case BUTTON_ENABLE:
    if (mBluetoothAdapter != null && !mBluetoothAdapter.isEnabled()) {
      Intent enable=new Intent(BluetoothAdapter.ACTION_REQUEST_ENABLE);
      startActivityForResult(enable,REQUEST_ENABLE);
    }
  break;
case BUTTON_FIND:
mMessageView.setText("Finding devices, please wait...");
mUnRegister=true;
IntentFilter filter=new IntentFilter(BluetoothDevice.ACTION_FOUND);
registerReceiver(mReceiver,filter);
mBluetoothAdapter.startDiscovery();
mButton.setText("Clear list");
mButton.setId(BUTTON_CLEAR);
break;
case BUTTON_CLEAR:
mButton.setText("Scan for Devices");
mButton.setId(BUTTON_FIND);
mMessageView.setText("Bluetooth is turned on");
mDeviceData.clear();
mDeviceData.add("No Devices");
mDelegate.notifyDataSetChanged();
break;
}
}
 

Example 41

From project android-voip-service, under directory /src/main/java/org/linphone/.

Source file: LinphoneManager.java

  17 
vote

private synchronized void startLibLinphone(final Context context){
  try {
    copyAssetsFromPackage(context);
    mLc=LinphoneCoreFactory.instance().createLinphoneCore(this,linphoneConfigFile,linphoneInitialConfigFile,null);
    mLc.enableIpv6(mPref.getBoolean(getString(R.string.pref_ipv6_key),false));
    mLc.setZrtpSecretsCache(basePath + "/zrtp_secrets");
    mLc.setPlaybackGain(3);
    mLc.setRing(null);
    mLc.setRootCA(linphoneRootCaFile);
    try {
      initFromConf(context);
    }
 catch (    LinphoneException e) {
      Log.w("no config ready yet");
    }
    TimerTask lTask=new TimerTask(){
      @Override public void run(){
        mLc.iterate();
      }
    }
;
    mTimer.scheduleAtFixedRate(lTask,0,100);
    IntentFilter lFilter=new IntentFilter(Intent.ACTION_SCREEN_ON);
    lFilter.addAction(Intent.ACTION_SCREEN_OFF);
    context.registerReceiver(mKeepAliveReceiver,lFilter);
  }
 catch (  Exception e) {
    Log.e(e,"Cannot start linphone");
  }
}
 

Example 42

From project Android_1, under directory /sms/src/com/novoda/sms/.

Source file: SMS.java

  17 
vote

private void sendSMS(String phoneNumber,String message){
  registerReceiver(new SmsSentReciever(),new IntentFilter(Constants.SENT));
  registerReceiver(new SmsDeliveredReciever(),new IntentFilter(Constants.DELIVERED));
  PendingIntent sentPI=PendingIntent.getBroadcast(this,0,new Intent(Constants.SENT),0);
  PendingIntent deliveredPI=PendingIntent.getBroadcast(this,0,new Intent(Constants.DELIVERED),0);
  SmsManager.getDefault().sendTextMessage(phoneNumber,null,message,sentPI,deliveredPI);
}
 

Example 43

From project android_5, under directory /src/aarddict/android/.

Source file: DictionaryService.java

  17 
vote

@Override public void onCreate(){
  Log.d(TAG,"On create");
  library=new Library();
  loadDictFileList();
  broadcastReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      String action=intent.getAction();
      Uri path=intent.getData();
      Log.d(TAG,String.format("action: %s, path: %s",action,path));
      stopSelf();
    }
  }
;
  IntentFilter intentFilter=new IntentFilter();
  intentFilter.addDataScheme("file");
  intentFilter.addAction(Intent.ACTION_MEDIA_EJECT);
  intentFilter.addAction(Intent.ACTION_MEDIA_BAD_REMOVAL);
  intentFilter.addAction(Intent.ACTION_MEDIA_REMOVED);
  registerReceiver(broadcastReceiver,intentFilter);
}
 

Example 44

From project android_packages_apps_CellBroadcastReceiver, under directory /src/com/android/cellbroadcastreceiver/.

Source file: CellBroadcastAlertDialog.java

  17 
vote

@Override protected void onCreate(Bundle icicle){
  super.onCreate(icicle);
  if (mMessage.isEmergencyAlertMessage()) {
    mScreenOffReceiver=new ScreenOffReceiver();
    registerReceiver(mScreenOffReceiver,new IntentFilter(Intent.ACTION_SCREEN_OFF));
  }
}
 

Example 45

From project android_packages_apps_Nfc, under directory /src/com/android/nfc/handover/.

Source file: BluetoothHeadsetHandover.java

  17 
vote

/** 
 * Main entry point. This method is usually called after construction, to begin the BT sequence. Must be called on Main thread.
 */
public void start(){
  checkMainThread();
  if (mState != STATE_INIT)   return;
  IntentFilter filter=new IntentFilter();
  filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
  filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
  filter.addAction(BluetoothA2dp.ACTION_CONNECTION_STATE_CHANGED);
  filter.addAction(BluetoothHeadset.ACTION_CONNECTION_STATE_CHANGED);
  filter.addAction(ACTION_ALLOW_CONNECT);
  filter.addAction(ACTION_DENY_CONNECT);
  mContext.registerReceiver(mReceiver,filter);
  if (mA2dp.getConnectedDevices().contains(mDevice) || mHeadset.getConnectedDevices().contains(mDevice)) {
    Log.i(TAG,"ACTION_DISCONNECT addr=" + mDevice + " name="+ mName);
    mAction=ACTION_DISCONNECT;
  }
 else {
    Log.i(TAG,"ACTION_CONNECT addr=" + mDevice + " name="+ mName);
    mAction=ACTION_CONNECT;
  }
  mHandler.sendMessageDelayed(mHandler.obtainMessage(MSG_TIMEOUT),TIMEOUT_MS);
  nextStep();
}
 

Example 46

From project android_packages_apps_Superuser, under directory /src/com/noshufou/android/su/.

Source file: SuRequestActivity.java

  17 
vote

@TargetApi(10) @Override protected void onResume(){
  super.onResume();
  if (mPrefs.getBoolean(Preferences.USE_ALLOW_TAG,false) && VERSION.SDK_INT > VERSION_CODES.GINGERBREAD) {
    mNfcAdapter=NfcAdapter.getDefaultAdapter(this);
    PendingIntent pendingIntent=PendingIntent.getActivity(this,0,new Intent(this,getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP),0);
    IntentFilter ndef=new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
    try {
      ndef.addDataType("text/x-su-a");
    }
 catch (    MalformedMimeTypeException e) {
      Log.e(TAG,"Bad MIME type declared",e);
      return;
    }
    IntentFilter[] filters=new IntentFilter[]{ndef};
    String[][] techLists=new String[][]{new String[]{Ndef.class.getName()}};
    mNfcAdapter.enableForegroundDispatch(this,pendingIntent,filters,techLists);
  }
}
 

Example 47

From project android_packages_wallpapers_basic, under directory /src/com/android/wallpaper/grass/.

Source file: GrassRS.java

  17 
vote

@Override public void start(){
  super.start();
  if (mTimezoneTracker == null) {
    mTimezoneTracker=new TimezoneTracker();
    IntentFilter filter=new IntentFilter();
    filter.addAction(Intent.ACTION_DATE_CHANGED);
    filter.addAction(Intent.ACTION_TIME_CHANGED);
    filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
    mContext.registerReceiver(mTimezoneTracker,filter);
  }
  if (mLocationUpdater == null) {
    mLocationUpdater=new LocationUpdater();
    try {
      mLocationManager.requestLocationUpdates(LocationManager.NETWORK_PROVIDER,LOCATION_UPDATE_MIN_TIME,LOCATION_UPDATE_MIN_DISTANCE,mLocationUpdater);
    }
 catch (    java.lang.IllegalArgumentException e) {
      if (!e.getMessage().equals("provider=network")) {
        throw e;
      }
    }
  }
  updateLocation();
}
 

Example 48

From project andstatus, under directory /src/org/andstatus/app/.

Source file: MyService.java

  17 
vote

@Override public void onCreate(){
  MyPreferences.initialize(this,this);
  preferencesChangeTime=MyPreferences.getDefaultSharedPreferences().getLong(MyPreferences.KEY_PREFERENCES_CHANGE_TIME,0);
  preferencesExamineTime=getMyServicePreferences().getLong(MyPreferences.KEY_PREFERENCES_EXAMINE_TIME,0);
  MyLog.d(TAG,"Service created, preferencesChangeTime=" + preferencesChangeTime + ", examined="+ preferencesExamineTime);
  registerReceiver(intentReceiver,new IntentFilter(ACTION_GO));
}
 

Example 49

From project andtweet, under directory /src/com/xorcode/andtweet/.

Source file: AndTweetService.java

  17 
vote

@Override public void onCreate(){
  AndTweetPreferences.initialize(this,this);
  preferencesChangeTime=AndTweetPreferences.getDefaultSharedPreferences().getLong(PreferencesActivity.KEY_PREFERENCES_CHANGE_TIME,0);
  preferencesExamineTime=getServiceSp().getLong(PreferencesActivity.KEY_PREFERENCES_EXAMINE_TIME,0);
  d(TAG,"Service created, preferencesChangeTime=" + preferencesChangeTime + ", examined="+ preferencesExamineTime);
  registerReceiver(intentReceiver,new IntentFilter(ACTION_GO));
}
 

Example 50

From project BART, under directory /src/pro/dbro/bart/.

Source file: UsherService.java

  17 
vote

@Override public void onCreate(){
  super.onCreate();
  c=this;
  mNM=(NotificationManager)getSystemService(NOTIFICATION_SERVICE);
  LocalBroadcastManager.getInstance(this).registerReceiver(serviceDataMessageReceiver,new IntentFilter("service_status_change"));
}
 

Example 51

From project Bitcoin-Wallet-for-Android, under directory /wallet/src/de/schildbach/wallet/ui/.

Source file: BlockchainStateFragment.java

  17 
vote

@Override public void onResume(){
  super.onResume();
  activity.registerReceiver(broadcastReceiver,new IntentFilter(BlockchainService.ACTION_BLOCKCHAIN_STATE));
  broadcastReceiver.active.set(true);
  updateView();
}
 

Example 52

From project bitfluids, under directory /src/main/java/at/bitcoin_austria/bitfluids/trafficSignal/.

Source file: TrafficSignal.java

  17 
vote

/** 
 * @param trafficSignReciever where you will be notified
 * @return the BroadcastReceiver to unregister by the UI
 */
public BroadcastReceiver addNotifier(final TrafficSignalReciever trafficSignReciever){
  checkInternet(trafficSignReciever);
  IntentFilter intentFilter=new IntentFilter();
  intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
  BroadcastReceiver receiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      checkInternet(trafficSignReciever);
    }
  }
;
  context.registerReceiver(receiver,intentFilter);
  bitcoinNet.addPeerCountListener(new Consumer<Integer>(){
    @Override public void consume(    Integer count){
      if (count < 1) {
        trafficSignReciever.onStatusChanged(SignalType.PEERS,Status.RED);
      }
 else       if (count < BitcoinTransactionListener.MAX_CONNECTIONS) {
        trafficSignReciever.onStatusChanged(SignalType.PEERS,Status.YELLOW);
      }
 else {
        trafficSignReciever.onStatusChanged(SignalType.PEERS,Status.GREEN);
      }
    }
  }
);
  priceService.addLastQuoteListener(new Consumer<Status>(){
    @Override public void consume(    Status status){
      trafficSignReciever.onStatusChanged(SignalType.EXCHANGERATE,status);
    }
  }
);
  return receiver;
}
 

Example 53

From project BombusLime, under directory /src/org/bombusim/lime/activity/.

Source file: LoggerActivity.java

  17 
vote

@Override protected void onResume(){
  super.onResume();
  updateLogSize();
  br=new LoggerBroadcastReceiver();
  registerReceiver(br,new IntentFilter(LoggerData.UPDATE_LOG));
}
 

Example 54

From project BSPAN---Bluetooth-Sensor-Processing-for-Android, under directory /AndroidBTService/src/com/t2/biofeedback/activity/.

Source file: BTServiceManager.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setContentView(R.layout.manager);
  this.findViewById(R.id.bluetoothSettingsButton).setOnClickListener(this);
  this.findViewById(R.id.about).setOnClickListener(this);
  this.deviceManager=DeviceManager.getInstanceNoCreate();
  if (this.deviceManager == null) {
    Log.e(TAG,"There is no device manager instance!");
    return;
  }
  this.deviceList=(ListView)this.findViewById(R.id.list);
  this.deviceListAdapter=new ManagerItemAdapter(this,this.deviceManager,R.layout.manager_item);
  this.deviceList.setAdapter(this.deviceListAdapter);
  this.generalBroadcastReceiver=new GeneralReceiver();
  IntentFilter filter=new IntentFilter();
  filter.addAction(BluetoothDevice.ACTION_BOND_STATE_CHANGED);
  filter.addAction(BluetoothAdapter.ACTION_STATE_CHANGED);
  filter.addAction(BioFeedbackService.ACTION_STATUS_BROADCAST);
  this.registerReceiver(this.generalBroadcastReceiver,filter);
  this.bluetoothDisabledDialog=new AlertDialog.Builder(this).setMessage("Bluetooth is not enabled.").setOnCancelListener(new OnCancelListener(){
    @Override public void onCancel(    DialogInterface dialog){
      finish();
    }
  }
).setPositiveButton("Setup Bluetooth",new DialogInterface.OnClickListener(){
    @Override public void onClick(    DialogInterface dialog,    int which){
      startBluetoothSettings();
    }
  }
).create();
  try {
    PackageManager packageManager=this.getPackageManager();
    PackageInfo info=packageManager.getPackageInfo(this.getPackageName(),0);
    mVersionName=info.versionName;
    Log.i(TAG,"Spine server Test Application Version " + mVersionName);
  }
 catch (  NameNotFoundException e) {
    Log.e(TAG,e.toString());
  }
}
 

Example 55

From project cicada, under directory /cicada/src/org/cicadasong/cicada/.

Source file: AppList.java

  17 
vote

@Override protected void onResume(){
  paint=new Paint();
  paint.setTypeface(Typeface.DEFAULT);
  if (apps == null) {
    loadApps();
  }
  IntentFilter filter=new IntentFilter();
  filter.addAction(PackageMonitor.INTENT_APPS_CHANGED);
  receiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      loadApps();
      changeSelection(selectedIndex);
    }
  }
;
  registerReceiver(receiver,filter);
}
 

Example 56

From project Cura, under directory /src/com/cura/.

Source file: AccountsListActivity.java

  17 
vote

@Override protected void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  this.setTitle(R.string.LoginScreenName);
  prefs=PreferenceManager.getDefaultSharedPreferences(this);
  rv=new regexValidator();
  user=getUser();
  array=new CustomArrayAdapter(this,user);
  setListAdapter(array);
  registerForContextMenu(getListView());
  databaseBR=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      user=getUser();
      array=new CustomArrayAdapter(AccountsListActivity.this,user);
      setListAdapter(array);
      Log.d("onResume","onResume");
    }
  }
;
  IntentFilter databaseIntentFilter=new IntentFilter();
  databaseIntentFilter.addAction(deleteDB);
  registerReceiver(databaseBR,databaseIntentFilter);
  vibrator=(Vibrator)getSystemService(Context.VIBRATOR_SERVICE);
}
 

Example 57

From project cw-android, under directory /Internet/Download/src/com/commonsware/android/download/.

Source file: DownloadDemo.java

  17 
vote

@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  mgr=(DownloadManager)getSystemService(DOWNLOAD_SERVICE);
  registerReceiver(onComplete,new IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE));
  registerReceiver(onNotificationClick,new IntentFilter(DownloadManager.ACTION_NOTIFICATION_CLICKED));
}
 

Example 58

From project dccsched, under directory /src/com/underhilllabs/dccsched/ui/.

Source file: BlocksActivity.java

  17 
vote

@Override protected void onResume(){
  super.onResume();
  final Uri blocksUri=getIntent().getData();
  mHandler.startQuery(blocksUri,BlocksQuery.PROJECTION,Blocks.DEFAULT_SORT);
  final IntentFilter filter=new IntentFilter();
  filter.addAction(Intent.ACTION_TIME_TICK);
  filter.addAction(Intent.ACTION_TIME_CHANGED);
  filter.addAction(Intent.ACTION_TIMEZONE_CHANGED);
  registerReceiver(mReceiver,filter,null,new Handler());
  mNowView.post(new Runnable(){
    public void run(){
      updateNowView(true);
    }
  }
);
}
 

Example 59

From project DeskSMS, under directory /DeskSMS/src/com/koushikdutta/desktopsms/.

Source file: TickleServiceHelper.java

  17 
vote

static void registerForPush(final Context context,final Callback<Void> callback){
  Intent registrationIntent=new Intent("com.google.android.c2dm.intent.REGISTER");
  registrationIntent.putExtra("app",PendingIntent.getBroadcast(context,0,new Intent(),0));
  registrationIntent.putExtra("sender","[email protected]");
  if (callback != null) {
    BroadcastReceiver receiver=new BroadcastReceiver(){
      @Override public void onReceive(      Context context,      Intent intent){
        context.unregisterReceiver(this);
        callback.onCallback(null);
      }
    }
;
    IntentFilter filter=new IntentFilter(C2DMReceiver.ACTION_REGISTRATION_RECEIVED);
    context.registerReceiver(receiver,filter);
  }
  context.startService(registrationIntent);
}
 

Example 60

From project Absolute-Android-RSS, under directory /src/com/AA/Activities/.

Source file: AAMain.java

  16 
vote

/** 
 * Called when the activity is created and put into memory. This is where all GUI elements should be set up and any other member variables that is used throughout the class
 */
@Override public void onCreate(Bundle savedInstanceState){
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  articles=new ArrayList<Article>();
  settings=this.getSharedPreferences("settings",0);
  AlarmReceiver.stopAlarm(this);
  adapter=new ArticleAdapter(this);
  this.setListAdapter(adapter);
  ib_refresh=(ImageButton)findViewById(R.id.ib_refresh);
  TextView tv=(TextView)findViewById(R.id.AATitle);
  Typeface face=Typeface.createFromAsset(getAssets(),"fonts/WREXHAM_.TTF");
  tv.setTypeface(face);
  finishReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      articles.clear();
      Bundle articleBundle=intent.getBundleExtra("articles");
      ArrayList<String> titles=articleBundle.getStringArrayList("titles");
      for (      String title : titles)       articles.add((Article)articleBundle.getSerializable(title));
      progressDialog.cancel();
      refresh();
    }
  }
;
  this.registerReceiver(finishReceiver,new IntentFilter("RSSFinish"));
  ib_refresh.setOnClickListener(new OnClickListener(){
    /** 
 * Handles when the user clicks the refresh button
 * @param v - view that was clicked
 */
    @Override public void onClick(    View v){
      runService();
    }
  }
);
  runService();
}
 

Example 61

From project AsmackService, under directory /src/com/googlecode/asmack/connection/.

Source file: XmppTransportService.java

  16 
vote

/** 
 * Initialize the xmpp service, binding all required receivers.
 */
@Override public void onCreate(){
  super.onCreate();
  accountManager=AccountManager.get(this);
  ContentProviderClient provider=getContentResolver().acquireContentProviderClient(ContactsContract.AUTHORITY_URI);
  ContactDataMapper mapper=new ContactDataMapper(provider);
  BroadcastReceiver receiver=new PresenceBroadcastReceiver(mapper);
  registerReceiver(receiver,new IntentFilter(XmppTransportService.XMPP_STANZA_INTENT));
  receiver=new DiscoReceiver();
  registerReceiver(receiver,new IntentFilter(XmppTransportService.XMPP_STANZA_INTENT));
  receiver=new KeepaliveActionIntentReceiver(this);
  ;
  registerReceiver(receiver,new IntentFilter(Intent.ACTION_TIME_TICK));
  receiver=new SendStanzaReceiver(this);
  registerReceiver(receiver,new IntentFilter(XMPP_STANZA_SEND_INTENT));
  receiver=new ConnectivityReceiver(this);
  registerReceiver(receiver,new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
  accountManager.addOnAccountsUpdatedListener(this,null,true);
}
 

Example 62

From project BBC-News-Reader, under directory /src/com/digitallizard/bbcnewsreader/.

Source file: ResourceService.java

  16 
vote

@Override public void onCreate(){
  loadInProgress=false;
  if (settings == null) {
    settings=getSharedPreferences(ReaderActivity.PREFS_FILE_NAME,MODE_PRIVATE);
  }
  if (database == null) {
    setDatabase(new DatabaseHandler(this));
    if (!getDatabase().isCreated()) {
      getDatabase().addCategoriesFromXml();
    }
  }
  if (getWebManager() == null) {
    setWebManager(new WebManager(this));
  }
  if (rssManager == null) {
    rssManager=new RSSManager(this);
  }
  broadcastReceiver=new BroadcastReceiver(){
    @Override public void onReceive(    Context context,    Intent intent){
      if (intent.getAction().equals("com.digitallizard.bbcnewsreader.action.LOAD_NEWS")) {
        loadData();
      }
    }
  }
;
  this.registerReceiver(broadcastReceiver,new IntentFilter(ACTION_LOAD));
  updateSettings();
  settingsChangedListener=new OnSharedPreferenceChangeListener(){
    public void onSharedPreferenceChanged(    SharedPreferences preferences,    String key){
      updateSettings();
    }
  }
;
  settings.registerOnSharedPreferenceChangeListener(settingsChangedListener);
}
 

Example 63

From project AmDroid, under directory /AmDroid/src/main/java/com/jaeckel/amenoid/cwac/bus/.

Source file: IntentBus.java

  15 
vote

public DirectIntentFilter(Intent i) throws IntentFilter.MalformedMimeTypeException {
  super(i.getAction());
  addDataType(i.getType());
  addDataScheme(i.getData().getScheme());
  addDataAuthority(i.getData().getHost(),String.valueOf(i.getData().getPort()));
  addDataPath(i.getData().getPath(),PatternMatcher.PATTERN_LITERAL);
}
 

Example 64

From project android-marvin, under directory /marvin/src/main/java/de/akquinet/android/marvin/monitor/.

Source file: ExtendedActivityMonitor.java

  15 
vote

public ExtendedActivityMonitor(Instrumentation instrumentation,IntentFilter filter){
  activityInstanceMonitor=instrumentation.addMonitor(filter,null,false);
  this.activityMonitorThread=new Thread(){
    @Override public void run(){
      ThreadPoolExecutor executor=new ThreadPoolExecutor(2,5,5,TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(5));
      while (true) {
        Activity activity=activityInstanceMonitor.waitForActivityWithTimeout(CHECK_FOR_INTERRUPT_CYCLE_DURATION);
        long startTime=System.currentTimeMillis();
        if (activity != null) {
          int activitiesCount=startedActivities.size();
          if (activitiesCount > 0 && startedActivities.get(activitiesCount - 1).getActivity() == activity) {
            continue;
          }
synchronized (startedActivities) {
            startedActivities.add(new StartedActivity(activity,startTime));
          }
          Log.i(getClass().getSimpleName(),"Activity start: " + activity.getClass().getName());
          executor.submit(new ActivityStartListenerUpdater(activity));
        }
        if (interrupted() || stopped) {
          executor.shutdown();
          return;
        }
      }
    }
  }
;
}