List of usage examples for android.app Service START_REDELIVER_INTENT
int START_REDELIVER_INTENT
To view the source code for android.app Service START_REDELIVER_INTENT.
Click Source Link
From source file:com.otaupdater.stats.ReportingService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "User has opted in -- reporting."); Thread thread = new Thread() { @Override// ww w. j a v a2 s. c o m public void run() { report(); } }; thread.start(); return Service.START_REDELIVER_INTENT; }
From source file:com.android.settings.cmstats.ReportingService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "User has opted in -- reporting."); if (mTask == null || mTask.getStatus() == AsyncTask.Status.FINISHED) { mTask = new StatsUploadTask(); mTask.execute();/*from w ww . j a v a2s. c o m*/ } return Service.START_REDELIVER_INTENT; }
From source file:com.android.settings.aokpstats.ReportingService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { if (intent.getBooleanExtra("firstBoot", false)) { promptUser();/*from w ww. j ava 2s.com*/ Log.d(TAG, "Prompting user for opt-in."); } else { Log.d(TAG, "User has opted in -- reporting."); Thread thread = new Thread() { @Override public void run() { report(); } }; thread.start(); } return Service.START_REDELIVER_INTENT; }
From source file:android.romstats.ReportingService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { boolean canReport = true; if (intent.getBooleanExtra("promptUser", false)) { Log.d(Const.TAG, "Prompting user for opt-in."); promptUser();/*from w w w .j a v a 2s .c om*/ canReport = false; } String RomStatsUrl = Utilities.getStatsUrl(); if (RomStatsUrl == null || RomStatsUrl.isEmpty()) { Log.e(Const.TAG, "This ROM is not configured for ROM Statistics."); canReport = false; } if (canReport) { Log.d(Const.TAG, "User has opted in -- reporting."); if (mTask == null || mTask.getStatus() == AsyncTask.Status.FINISHED) { mTask = new StatsUploadTask(); mTask.execute(); } } return Service.START_REDELIVER_INTENT; }
From source file:air.com.snagfilms.cast.chromecast.notifications.VideoCastNotificationService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { Log.d(TAG, "onStartCommand"); if (null != intent) { String action = intent.getAction(); if (ACTION_TOGGLE_PLAYBACK.equals(action) && mIsIcsOrAbove) { Log.d(TAG, "onStartCommand(): Action: ACTION_TOGGLE_PLAYBACK"); togglePlayback();//from w ww . j a v a2s . c o m } else if (ACTION_STOP.equals(action) && mIsIcsOrAbove) { Log.d(TAG, "onStartCommand(): Action: ACTION_STOP"); stopApplication(); } else if (ACTION_VISIBILITY.equals(action)) { mVisible = intent.getBooleanExtra("visible", false); // mVisible=true; Log.d(TAG, "onStartCommand(): Action: ACTION_VISIBILITY " + mVisible); if (mVisible && null != mNotification) { startForeground(NOTIFICATION_ID, mNotification); } else { stopForeground(true); } } else { Log.d(TAG, "onStartCommand(): Action: none"); } } else { Log.d(TAG, "onStartCommand(): Intent was null"); } return Service.START_REDELIVER_INTENT; }
From source file:org.mozilla.gecko.updater.UpdateService.java
@Override public synchronized int onStartCommand(Intent intent, int flags, int startId) { // If we are busy doing a download, the new Intent here would normally be queued for // execution once that is done. In this case, however, we want to flip the boolean // while that is running, so handle that now. if (mDownloading && UpdateServiceHelper.ACTION_APPLY_UPDATE.equals(intent.getAction())) { Log.i(LOGTAG, "will apply update when download finished"); mApplyImmediately = true;// ww w .ja va 2s . c om showDownloadNotification(); } else if (UpdateServiceHelper.ACTION_CANCEL_DOWNLOAD.equals(intent.getAction())) { mCancelDownload = true; } else { super.onStartCommand(intent, flags, startId); } return Service.START_REDELIVER_INTENT; }
From source file:com.firefly.sample.castcompanionlibrary.notification.VideoCastNotificationService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { LOGD(TAG, "onStartCommand"); if (null != intent) { String action = intent.getAction(); if (ACTION_TOGGLE_PLAYBACK.equals(action) && mIsIcsOrAbove) { LOGD(TAG, "onStartCommand(): Action: ACTION_TOGGLE_PLAYBACK"); togglePlayback();//from w ww. ja v a 2 s. co m } else if (ACTION_STOP.equals(action) && mIsIcsOrAbove) { LOGD(TAG, "onStartCommand(): Action: ACTION_STOP"); stopApplication(); } else if (ACTION_VISIBILITY.equals(action)) { mVisible = intent.getBooleanExtra("visible", false); LOGD(TAG, "onStartCommand(): Action: ACTION_VISIBILITY " + mVisible); if (mVisible && null != mNotification) { startForeground(NOTIFICATION_ID, mNotification); } else { stopForeground(true); } } else { LOGD(TAG, "onStartCommand(): Action: none"); } } else { LOGD(TAG, "onStartCommand(): Intent was null"); } return Service.START_REDELIVER_INTENT; }
From source file:com.psiphon3.psiphonlibrary.TunnelManager.java
public int onStartCommand(Intent intent, int flags, int startId) { if (mNotificationManager == null) { mNotificationManager = (NotificationManager) m_parentService .getSystemService(Context.NOTIFICATION_SERVICE); }/* www .j a v a 2s . c o m*/ if (mNotificationBuilder == null) { mNotificationBuilder = new NotificationCompat.Builder(m_parentService); } if (m_firstStart && intent != null) { getTunnelConfig(intent); m_parentService.startForeground(R.string.psiphon_service_notification_id, this.createNotification(false)); MyLog.v(R.string.client_version, MyLog.Sensitivity.NOT_SENSITIVE, EmbeddedValues.CLIENT_VERSION); m_firstStart = false; m_tunnelThreadStopSignal = new CountDownLatch(1); m_tunnelThread = new Thread(new Runnable() { @Override public void run() { runTunnel(); } }); m_tunnelThread.start(); } return Service.START_REDELIVER_INTENT; }
From source file:com.nttec.everychan.ui.downloading.DownloadingService.java
@Override @SuppressLint("InlinedApi") public int onStartCommand(Intent intent, int flags, int startId) { onStart(intent, startId);/*from w w w . ja v a2 s.co m*/ return Service.START_REDELIVER_INTENT; }
From source file:eu.geopaparazzi.library.gps.GpsService.java
@Override public int onStartCommand(Intent intent, int flags, int startId) { // GPLog.addLogEntry(this, "onStartCommand called with intent: " + intent); /*/* w w w . jav a2s.co m*/ * If startService(intent) is called while the service is running, * its onStartCommand() is also called. Therefore your service needs * to be prepared that onStartCommand() can be called several times. */ if (preferences == null) { preferences = PreferenceManager.getDefaultSharedPreferences(this); useNetworkPositions = preferences.getBoolean(LibraryConstants.PREFS_KEY_GPS_USE_NETWORK_POSITION, false); isMockMode = preferences.getBoolean(LibraryConstants.PREFS_KEY_MOCKMODE, false); toastHandler = new Handler(); log("onStartCommand: Preferences created"); } if (locationManager == null) { locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE); if (ActivityCompat.checkSelfPermission(this, Manifest.permission.ACCESS_FINE_LOCATION) != PackageManager.PERMISSION_GRANTED) { return Service.START_FLAG_RETRY; } locationManager.addGpsStatusListener(this); isProviderEnabled = isGpsOn(); log("onStartCommand: LocationManager created + GpsService started"); } if (!isListeningForUpdates) { registerForLocationUpdates(); log("onStartCommand: Registered for location updates"); } if (intent != null) { /* * START GPS logging */ if (intent.hasExtra(START_GPS_LOGGING)) { boolean startGpsLogging = intent.getBooleanExtra(START_GPS_LOGGING, false); if (startGpsLogging) { log("onStartCommand: Start GPS logging called"); if (!isDatabaseLogging) { String gpsLogName = intent.getStringExtra(START_GPS_LOG_NAME); String gpsLogHelperClass = intent.getStringExtra(START_GPS_LOG_HELPER_CLASS); boolean continueLastGpsLog = intent.getBooleanExtra(START_GPS_CONTINUE_LOG, false); try { Class<?> logHelper = Class.forName(gpsLogHelperClass); IGpsLogDbHelper newInstance = (IGpsLogDbHelper) logHelper.newInstance(); startDatabaseLogging(gpsLogName, continueLastGpsLog, newInstance); } catch (Exception e) { GPLog.error(this, "Could not start logging", e); } } } } if (intent.hasExtra(STOP_GPS_LOGGING)) { boolean stopGpsLogging = intent.getBooleanExtra(STOP_GPS_LOGGING, false); if (stopGpsLogging) { log("onStartCommand: Stop GPS logging called"); if (isDatabaseLogging) { stopDatabaseLogging(); } } } if (intent.hasExtra(GPS_SERVICE_DO_BROADCAST)) { log("onStartCommand: broadcast trigger"); boolean doBroadcast = intent.getBooleanExtra(GPS_SERVICE_DO_BROADCAST, false); if (doBroadcast) { broadcast("triggered by onStartCommand Intent"); } } } return Service.START_REDELIVER_INTENT; }