protected void startInForeground() { foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), service); foregroundServiceStarter.start(); foregroundStatus(); }
public ForegroundServiceStarter(Context context, Service service) { mContext = context; mService = service; //mHandler = new Handler(Looper.getMainLooper()); run_service_in_foreground = shouldRunCollectorInForeground(); }
@Override public void onDestroy() { super.onDestroy(); Log.d(TAG, "onDestroy entered"); foregroundServiceStarter.stop(); //BgToSpeech.tearDownTTS(); Log.i(TAG, "SERVICE STOPPED"); // ???? What will realy stop me, or am I already stopped??? try { prefs.unregisterOnSharedPreferenceChangeListener(prefListener); } catch (Exception e) { Log.e(TAG, "Exception unregistering prefListener"); } }
public void start() { if (mService == null) { Log.e(TAG, "SERVICE IS NULL - CANNOT START!"); return; } if (run_service_in_foreground) { Log.d(TAG, "should be moving to foreground"); // mHandler.post(new Runnable() { // @Override // public void run() { // TODO use constants final long end = System.currentTimeMillis() + (60000 * 5); final long start = end - (60000 * 60 * 3) - (60000 * 10); foregroundStatus(); Log.d(TAG, "CALLING START FOREGROUND: " + mService.getClass().getSimpleName()); mService.startForeground(ongoingNotificationId, new Notifications().createOngoingNotification(new BgGraphBuilder(mContext, start, end), mContext)); // } // }); } }
@Override public void onDestroy() { super.onDestroy(); Log.d(TAG, "onDestroy entered"); foregroundServiceStarter.stop(); //BgToSpeech.tearDownTTS(); Log.i(TAG, "SERVICE STOPPED"); // ???? What will realy stop me, or am I already stopped??? try { prefs.unregisterOnSharedPreferenceChangeListener(prefListener); } catch (Exception e) { Log.e(TAG, "Exception unregistering prefListener"); } }
public void start() { if (mService == null) { Log.e(TAG, "SERVICE IS NULL - CANNOT START!"); return; } if (run_service_in_foreground) { Log.d(TAG, "should be moving to foreground"); // mHandler.post(new Runnable() { // @Override // public void run() { // TODO use constants final long end = System.currentTimeMillis() + (60000 * 5); final long start = end - (60000 * 60 * 3) - (60000 * 10); foregroundStatus(); Log.d(TAG, "CALLING START FOREGROUND: " + mService.getClass().getSimpleName()); mService.startForeground(ongoingNotificationId, new Notifications().createOngoingNotification(new BgGraphBuilder(mContext, start, end), mContext)); // } // }); } }
protected void startInForeground() { foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), service); foregroundServiceStarter.start(); foregroundStatus(); }
@Override public void onDestroy() { super.onDestroy(); UserError.Log.d(TAG, "onDestroy entered"); foregroundServiceStarter.stop(); UserError.Log.i(TAG, "SERVICE STOPPED"); lastState = "Stopped " + JoH.hourMinuteString(); }
public ForegroundServiceStarter(Context context, Service service) { mContext = context; mService = service; //mHandler = new Handler(Looper.getMainLooper()); run_service_in_foreground = shouldRunCollectorInForeground(); }
protected void startInForeground() { foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), service); foregroundServiceStarter.start(); foregroundStatus(); }
@Override public void onDestroy() { super.onDestroy(); UserError.Log.d(TAG, "onDestroy entered"); foregroundServiceStarter.stop(); UserError.Log.i(TAG, "SERVICE STOPPED"); lastState = "Stopped " + JoH.hourMinuteString(); }
protected void startInForeground() { foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), service); foregroundServiceStarter.start(); foregroundStatus(); }
@Override public void onDestroy() { super.onDestroy(); close(); if (shouldServiceRun(getApplicationContext())) {//Android killed service setRetryTimer(); } else {//onDestroy triggered by CollectionServiceStart.stopBtService if (pendingIntent != null) { Log.d(TAG, "onDestroy stop Alarm serviceIntent"); AlarmManager alarm = (AlarmManager) getSystemService(ALARM_SERVICE); alarm.cancel(pendingIntent); } } foregroundServiceStarter.stop(); unregisterReceiver(mPairReceiver); //BgToSpeech.tearDownTTS(); Log.i(TAG, "SERVICE STOPPED"); }
protected void startInForeground() { foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), service); foregroundServiceStarter.start(); foregroundStatus(); }
@Override public void onDestroy() { super.onDestroy(); close(); if (shouldServiceRun(getApplicationContext())) {//Android killed service setRetryTimer(); } else {//onDestroy triggered by CollectionServiceStart.stopBtService if (pendingIntent != null) { Log.d(TAG, "onDestroy stop Alarm serviceIntent"); AlarmManager alarm = (AlarmManager) getSystemService(ALARM_SERVICE); alarm.cancel(pendingIntent); } } foregroundServiceStarter.stop(); unregisterReceiver(mPairReceiver); //BgToSpeech.tearDownTTS(); Log.i(TAG, "SERVICE STOPPED"); }
protected void startInForeground() { new ForegroundServiceStarter(getApplicationContext(), this).start(); foregroundStatus(); }
Log.d(TAG, "onDestroy entered"); close(); foregroundServiceStarter.stop();
protected void startInForeground() { new ForegroundServiceStarter(getApplicationContext(), this).start(); foregroundStatus(); }
Log.d(TAG, "onDestroy entered"); close(); foregroundServiceStarter.stop();
@Override public void onCreate() { foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), this); foregroundServiceStarter.start(); dexCollectionService = this; prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); listenForChangeInSettings(); UserError.Log.i(TAG, "onCreate: STARTING SERVICE"); }