List of usage examples for android.app Service START_NOT_STICKY
int START_NOT_STICKY
To view the source code for android.app Service START_NOT_STICKY.
Click Source Link
From source file:com.leo.LicenseMonitorLocalNetwork.services.LicSenseLiteNotificationService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { System.out.println("### Running notification onStartCommand"); //continue executing... serviceOnWhichIndex = intent.getIntExtra(LicLiteData.NOTIFICATION_RUNNING_INDEX, -1); Runnable myThread = new Runnable() { int notificationBeanListIndex = serviceOnWhichIndex; @Override//from w w w .ja v a 2s .c o m public void run() { try { //wait for later computation to complete Thread.sleep(1000); } catch (InterruptedException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } NotificationBean notificationBean = LicLiteData.notificationList.get(notificationBeanListIndex); int notificationPollingPeriod = Integer.parseInt(notificationBean.getNotificationPollingPeriod()) * 1000; while (notificationBean.getConnection() != null) { monitoringLicenseAndSendNotification(notificationBean); try { Thread.sleep(notificationPollingPeriod); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } }; new Thread(myThread).start(); // return Service.START_CONTINUATION_MASK; return Service.START_NOT_STICKY; // return Service.START_STICKY; // return Service.START_REDELIVER_INTENT; }
From source file:com.saarang.samples.apps.iosched.service.FeedbackListenerService.java
public int onStartCommand(Intent intent, int flags, int startId) { if (null != intent) { String action = intent.getAction(); if (SessionAlarmService.ACTION_NOTIFICATION_DISMISSAL.equals(action)) { String sessionId = intent.getStringExtra(SessionAlarmService.KEY_SESSION_ID); LogUtils.LOGD(TAG,/*from w ww .j ava 2 s . c o m*/ "onStartCommand(): Action = ACTION_NOTIFICATION_DISMISSAL Session: " + sessionId); dismissWearableNotification(sessionId); } } return Service.START_NOT_STICKY; }
From source file:org.ocs.android.agent.service.OCSAgentService.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { mOcssetting = OCSSettings.getInstance(getApplicationContext()); OCSLog ocslog = OCSLog.getInstance(); ocslog.debug("ocsservice wake : " + new Date().toString()); if (intent.getExtras() != null) { mIsForced = intent.getExtras().getBoolean(FORCE_UPDATE); mSaveInventory = intent.getExtras().getBoolean(SAVE_INVENTORY); }/* www . ja v a2 s.c o m*/ // Au cas ou l'option a chang depuis le lancement du service if (!mOcssetting.isAutoMode() && !mIsForced) { return Service.START_NOT_STICKY; } try { int vcode = getPackageManager().getPackageInfo(getPackageName(), 0).versionCode; new OCSProtocol(getApplicationContext()).verifyNewVersion(vcode); } catch (NameNotFoundException e) { } int freq = mOcssetting.getFreqMaj(); long lastUpdt = mOcssetting.getLastUpdt(); long delta = System.currentTimeMillis() - lastUpdt; ocslog.debug("now : " + System.currentTimeMillis()); ocslog.debug("last update : " + lastUpdt); ocslog.debug("delta laps : " + delta); ocslog.debug("freqmaj : " + freq * HOUR_IN_MILLIS); if ((delta > freq * HOUR_IN_MILLIS && isOnline()) || mIsForced) { ocslog.debug("mIsForced : " + mIsForced); ocslog.debug("bool date : " + (delta > freq * HOUR_IN_MILLIS)); AsyncCall task = new AsyncCall(getApplicationContext()); task.execute(); } return Service.START_NOT_STICKY; }
From source file:com.tenkiv.tekdaqc.android.services.CommunicationService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { // Extract the service instruction final String action = intent.getAction(); Log.d(TAG, "Received start command: " + action); // Build the message parameters Bundle extras = intent.getExtras();/* w w w .j av a 2 s . com*/ if (extras == null) extras = new Bundle(); extras.putString(TekCast.EXTRA_SERVICE_ACTION, action); // Run each task in a background thread. final Message msg = mServiceHandler.obtainMessage(); msg.arg1 = startId; msg.setData(extras); Log.d(TAG, "Sending message to background thread."); mServiceHandler.sendMessage(msg); return Service.START_NOT_STICKY; }
From source file:com.owncloud.android.services.observer.SyncedFolderObserverService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { return Service.START_NOT_STICKY; }
From source file:org.ocs.android.agent.service.OCSDownloadService.java
@Override public int onStartCommand(final Intent intent, final int flags, final int startId) { mOcssetting = OCSSettings.getInstance(getApplicationContext()); mOcslog = OCSLog.getInstance();/*from w w w.j a v a2 s . c o m*/ // Read the prolog reply file describing the jobs OCSFiles mOcsfiles = new OCSFiles(getApplicationContext()); mReply = mOcsfiles.loadPrologReply(); mOcslog.debug("mFragLatency : " + mReply.getFragLatency()); mOcslog.debug("mPeriodLatency : " + mReply.getPeriodLatency()); mOcslog.debug("mCycleLatency : " + mReply.getCycleLatency()); mOcslog.debug("mTimeout : " + mReply.getTimeout()); AsyncCall task = new AsyncCall(getApplicationContext()); task.execute(); return Service.START_NOT_STICKY; }
From source file:com.miz.service.TheTVDB.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { super.onStartCommand(intent, flags, startId); final Bundle bundle = intent.getExtras(); files = bundle.getStringArray("files"); rowsToDrop = bundle.getStringArray("rowsToDrop"); isEpisodeIdentify = bundle.getBoolean("isEpisodeIdentify", false); isShowIdentify = bundle.getBoolean("isShowIdentify", false); isUnidentifiedIdentify = bundle.getBoolean("isUnidentifiedIdentify", false); isUpdate = bundle.getBoolean("isUpdate", false); rowId = bundle.getLong("rowId", 0); language = bundle.getString("language", ""); for (int i = 0; i < files.length; i++) queue.add(files[i]);//from w w w. ja va2s. co m setup(); new Thread() { @Override public void run() { tvdb = new TheTVDb(getApplicationContext()); if (isUpdate) { thisShow = tvdb.searchForShow(MizLib.decryptEpisode(files[0], PreferenceManager .getDefaultSharedPreferences(getApplicationContext()).getString("ignoredTags", "")), LOCALE); createShow("", ""); } else if (isUnidentifiedIdentify) { thisShow = tvdb.getShow(bundle.getString("tvdbId"), LOCALE); if (rowsToDrop != null) { DbAdapterTvShowEpisode db = MizuuApplication.getTvEpisodeDbAdapter(); for (int i = 0; i < rowsToDrop.length; i++) db.deleteEpisode(rowsToDrop[i]); createShow("", ""); } else { createShow(bundle.getString("season"), bundle.getString("episode")); } } else if (isEpisodeIdentify) { thisShow = tvdb.getShow(bundle.getString("tvdbId"), LOCALE); loadNextEpisode(bundle.getString("season"), bundle.getString("episode")); } else if (isShowIdentify) { // Delete the old show based on its ID TvShow temp = new TvShow(getApplicationContext(), bundle.getString("oldShowId"), "", "", "", "", "", "", "", "", false, "0"); MizLib.deleteShow(getApplicationContext(), temp, false); thisShow = tvdb.getShow(bundle.getString("tvdbId"), LOCALE); createShow("", ""); } } }.start(); return Service.START_NOT_STICKY; }
From source file:com.ncode.android.apps.schedo.iowear.HomeListenerService.java
public int onStartCommand(Intent intent, int flags, int startId) { Utils.LOGD(TAG, "onStartCommand"); if (null != intent) { String action = intent.getAction(); if (ACTION_DISMISS.equals(action)) { String sessionId = intent.getStringExtra(KEY_SESSION_ID); Utils.LOGD(TAG, "onStartCommand(): Action: ACTION_DISMISS Session: " + sessionId); dismissPhoneNotification(sessionId); } else if (ACTION_START_FEEDBACK.equals(action)) { Intent feedbackIntent = new Intent(this, PagerActivity.class); String sessionId = intent.getStringExtra(HomeListenerService.KEY_SESSION_ID); Utils.LOGD(TAG, "Received session id from data layer: " + sessionId); feedbackIntent.putExtra(HomeListenerService.KEY_SESSION_ID, sessionId); feedbackIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(feedbackIntent); NotificationManagerCompat.from(this).cancel(NOTIFICATION_ID); }//from w ww . j a v a 2s.c om } return Service.START_NOT_STICKY; }
From source file:br.com.devfest.norte.wear.HomeListenerService.java
public int onStartCommand(Intent intent, int flags, int startId) { LOGD(TAG, "onStartCommand"); if (null != intent) { String action = intent.getAction(); if (ACTION_DISMISS.equals(action)) { String sessionId = intent.getStringExtra(KEY_SESSION_ID); LOGD(TAG, "onStartCommand(): Action: ACTION_DISMISS Session: " + sessionId); dismissPhoneNotification(sessionId); } else if (ACTION_START_FEEDBACK.equals(action)) { Intent feedbackIntent = new Intent(this, PagerActivity.class); String sessionId = intent.getStringExtra(HomeListenerService.KEY_SESSION_ID); LOGD(TAG, "Received session id from data layer: " + sessionId); feedbackIntent.putExtra(HomeListenerService.KEY_SESSION_ID, sessionId); feedbackIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); startActivity(feedbackIntent); NotificationManagerCompat.from(this).cancel(NOTIFICATION_ID); }//from w ww.ja va2s.com } return Service.START_NOT_STICKY; }
From source file:org.digitalcampus.oppia.service.TrackerService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { boolean backgroundData = true; Bundle b = intent.getExtras();//from w w w .ja v a 2 s . c om if (b != null) { backgroundData = b.getBoolean("backgroundData"); } if (isOnline() && backgroundData) { Payload p = null; // check for updated courses // should only do this once a day or so.... prefs = PreferenceManager.getDefaultSharedPreferences(this); long lastRun = prefs.getLong("lastCourseUpdateCheck", 0); long lastSyncDate = prefs.getLong("lastClientSync", 0L); long now = System.currentTimeMillis() / 1000; if ((lastRun + (3600 * 12)) < now) { APIRequestTask task = new APIRequestTask(this); p = new Payload(MobileLearning.SERVER_COURSES_PATH); task.setAPIRequestListener(this); task.execute(p); Editor editor = prefs.edit(); editor.putLong("lastCourseUpdateCheck", now); editor.commit(); } // send activity trackers MobileLearning app = (MobileLearning) this.getApplication(); if (app.omSubmitTrackerMultipleTask == null) { Log.d(TAG, "Submitting trackers multiple task"); app.omSubmitTrackerMultipleTask = new SubmitTrackerMultipleTask(this); app.omSubmitTrackerMultipleTask.execute(); } if (app.omSubmitClientSyncTask == null) { Log.d(TAG, "Syncing and updating client task"); app.omSubmitClientSyncTask = new ClientDataSyncTask(this); app.omSubmitClientSyncTask.execute(); } // send quiz results if (app.omSubmitQuizAttemptsTask == null) { Log.d(TAG, "Submitting quiz task"); DbHelper db = new DbHelper(this); ArrayList<QuizAttempt> unsent = db.getUnsentQuizAttempts(); DatabaseManager.getInstance().closeDatabase(); if (unsent.size() > 0) { p = new Payload(unsent); app.omSubmitQuizAttemptsTask = new SubmitQuizAttemptsTask(this); app.omSubmitQuizAttemptsTask.execute(p); } } } return Service.START_NOT_STICKY; }