belongs to Maven artifact com.android.support:support-compat:28.0.0-alpha1
ServiceCompat
  public
  
  final
  
  class
  ServiceCompat
  
    extends Object
  
  
  
  
  
  
| java.lang.Object | |
| ↳ | android.support.v4.app.ServiceCompat | 
Helper for accessing features in Service.
Summary
Constants | |
|---|---|
int | 
        
          START_STICKY
          Constant to return from   | 
    
int | 
        
          STOP_FOREGROUND_DETACH
          Flag for   | 
    
int | 
        
          STOP_FOREGROUND_REMOVE
          Flag for   | 
    
Public methods | |
|---|---|
        
        
        static
        
        
        void
     | 
  
    
      
      stopForeground(Service service, int flags)
      
      
        Remove the passed service from foreground state, allowing it to be killed if more memory is needed.  | 
  
Inherited methods | |
|---|---|
  
    
  
    java.lang.Object
  
 | |
Constants
START_STICKY
int START_STICKY
Constant to return from onStartCommand(Intent, int, int): if this
 service's process is killed while it is started (after returning from
 onStartCommand(Intent, int, int)), then leave it in the started
 state but don't retain this delivered intent.  Later the system will try to
 re-create the service.  Because it is in the started state, it will
 guarantee to call onStartCommand(Intent, int, int) after creating
 the new service instance; if there are not any pending start commands to be
 delivered to the service, it will be called with a null intent
 object, so you must take care to check for this.
 
This mode makes sense for things that will be explicitly started and stopped to run for arbitrary periods of time, such as a service performing background music playback.
Constant Value: 1 (0x00000001)
STOP_FOREGROUND_DETACH
int STOP_FOREGROUND_DETACH
Flag for stopForeground(Service, int): if set, the notification previously provided
 to startForeground(int, Notification) will be detached from the service.
 Only makes sense when STOP_FOREGROUND_REMOVE is not set -- in this case, the
 notification will remain shown, but be completely detached from the service and so no longer
 changed except through direct calls to the
 notification manager.
 
 This flag will only work on
 N and later. It doesn't have any effect on earlier
 platform versions.
Constant Value: 2 (0x00000002)
STOP_FOREGROUND_REMOVE
int STOP_FOREGROUND_REMOVE
Flag for stopForeground(Service, int): if set, the notification previously provided
 to startForeground(int, Notification) will be removed.  Otherwise it
 will remain until a later call (to startForeground(int, Notification) or
 stopForeground(Service, int) removes it, or the service is destroyed.
Constant Value: 1 (0x00000001)
Public methods
stopForeground
void stopForeground (Service service, int flags)
Remove the passed service from foreground state, allowing it to be killed if more memory is needed.
| Parameters | |
|---|---|
service | 
        
          Service  | 
      
flags | 
        
          int: Additional behavior options: STOP_FOREGROUND_REMOVE,
 STOP_FOREGROUND_DETACH. | 
      
See also:
Annotations
Interfaces
- ActionBarDrawerToggle.Delegate
 - ActionBarDrawerToggle.DelegateProvider
 - ActivityCompat.OnRequestPermissionsResultCallback
 - ActivityCompat.PermissionCompatDelegate
 - FragmentManager.BackStackEntry
 - FragmentManager.OnBackStackChangedListener
 - LoaderManager.LoaderCallbacks
 - NotificationCompat.Action.Extender
 - NotificationCompat.Extender
 - SharedElementCallback.OnSharedElementsReadyListener
 - TaskStackBuilder.SupportParentable
 
Classes
- ActionBarDrawerToggle
 - ActivityCompat
 - ActivityManagerCompat
 - ActivityOptionsCompat
 - AlarmManagerCompat
 - AppLaunchChecker
 - AppOpsManagerCompat
 - BundleCompat
 - DialogFragment
 - Fragment
 - Fragment.SavedState
 - FragmentActivity
 - FragmentContainer
 - FragmentController
 - FragmentHostCallback
 - FragmentManager
 - FragmentManager.FragmentLifecycleCallbacks
 - FragmentManagerNonConfig
 - FragmentPagerAdapter
 - FragmentStatePagerAdapter
 - FragmentTabHost
 - FragmentTransaction
 - FrameMetricsAggregator
 - JobIntentService
 - ListFragment
 - LoaderManager
 - NavUtils
 - NotificationCompat
 - NotificationCompat.Action
 - NotificationCompat.Action.Builder
 - NotificationCompat.Action.WearableExtender
 - NotificationCompat.BigPictureStyle
 - NotificationCompat.BigTextStyle
 - NotificationCompat.Builder
 - NotificationCompat.CarExtender
 - NotificationCompat.CarExtender.UnreadConversation
 - NotificationCompat.CarExtender.UnreadConversation.Builder
 - NotificationCompat.DecoratedCustomViewStyle
 - NotificationCompat.InboxStyle
 - NotificationCompat.MessagingStyle
 - NotificationCompat.MessagingStyle.Message
 - NotificationCompat.Style
 - NotificationCompat.WearableExtender
 - NotificationCompatExtras
 - NotificationCompatSideChannelService
 - NotificationManagerCompat
 - RemoteInput
 - RemoteInput.Builder
 - ServiceCompat
 - ShareCompat
 - ShareCompat.IntentBuilder
 - ShareCompat.IntentReader
 - SharedElementCallback
 - TaskStackBuilder
 
Exceptions