private void hideProgressNotification() { service.stopForeground(true); }
public void stop() { context.stopForeground(true); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { deleteNotificationChannel(); } }
public void stop() { if (run_service_in_foreground) { Log.d(TAG, "should be moving out of foreground"); mService.stopForeground(true); } }
public void stop() { if (run_service_in_foreground) { Log.d(TAG, "should be moving out of foreground"); mService.stopForeground(true); } }
public void clearNotification() { if (mNotification != null) { if (mContext instanceof Service) { ((Service) mContext).stopForeground(true); mNotificationBuilder.setOngoing(false); mNotificationManager.cancel(NOTIFICATION_ID); } mNotification = null; mLastTrack = null; mLastBitmap = null; mNotificationBuilder = null; } }
protected void stopInForeground() { // TODO refuse to stop on oreo+ ? if (service != null) { service.stopForeground(true); } else { UserError.Log.e("FOREGROUND", "Cannot stop foreground as service is null"); } foregroundStatus(); }
protected void stopInForeground() { // TODO refuse to stop on oreo+ ? if (service != null) { service.stopForeground(true); } else { UserError.Log.e("FOREGROUND", "Cannot stop foreground as service is null"); } foregroundStatus(); }
protected void stopInForeground() { // TODO refuse to stop on oreo+ ? if (service != null) { service.stopForeground(true); } else { UserError.Log.e("FOREGROUND", "Cannot stop foreground as service is null"); } foregroundStatus(); }
@Override public int onStartCommand(Intent intent, int flags, int startId) { Service core = sCore; if (null != intent && null != core) { Log.i(TAG, "onStartCommand"); try { core.startForeground(NOTIFICATION_ID, new Notification()); startForeground(NOTIFICATION_ID, new Notification()); core.stopForeground(true); } catch (Exception e) { Log.e(TAG, e.getMessage(), e); } } return Service.START_NOT_STICKY; } }
public static void update(final Service service, Station station, MediaSessionCompat session) { // session can be null on update - happens when currently playing station was renamed if (session != null) { // update mSession mSession = session; } // build notification mNotification = getNotificationBuilder(service, station).build(); // display updated notification NotificationManager notificationManager = (NotificationManager) service.getSystemService(Context.NOTIFICATION_SERVICE); notificationManager.notify(PLAYER_SERVICE_NOTIFICATION_ID, mNotification); if (station.getPlaybackState() == PLAYBACK_STATE_STOPPED) { // make notification swipe-able service.stopForeground(false); } }
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { if(key.compareTo("run_service_in_foreground") == 0) { Log.d("FOREGROUND", "run_service_in_foreground changed!"); if (prefs.getBoolean("run_service_in_foreground", false)) { foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), service); foregroundServiceStarter.start(); Log.i(TAG, "Moving to foreground"); } else { service.stopForeground(true); Log.i(TAG, "Removing from foreground"); } } } };
public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { if(key.compareTo("run_service_in_foreground") == 0) { Log.d("FOREGROUND", "run_service_in_foreground changed!"); if (prefs.getBoolean("run_service_in_foreground", false)) { foregroundServiceStarter = new ForegroundServiceStarter(getApplicationContext(), service); foregroundServiceStarter.start(); Log.i(TAG, "Moving to foreground"); } else { service.stopForeground(true); Log.i(TAG, "Removing from foreground"); } } } };
} else service.stopForeground(true); ); } else service.stopForeground(true);
((Service) mContext).startForeground(NOTIFICATION_ID, mNotification); } else { ((Service) mContext).stopForeground(false);