• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2013 The Flutter Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 package io.flutter.embedding.engine.plugins.service;
6 
7 import android.app.Service;
8 import android.support.annotation.NonNull;
9 
10 /**
11  * Binding that gives {@link ServiceAware} plugins access to an associated {@link Service}.
12  */
13 public interface ServicePluginBinding {
14 
15   /**
16    * Returns the {@link Service} that is currently attached to the {@link FlutterEngine} that
17    * owns this {@code ServicePluginBinding}.
18    */
19   @NonNull
getService()20   Service getService();
21 
22   /**
23    * Adds the given {@code listener} to be notified when the associated {@link Service} goes
24    * from background to foreground, or foreground to background.
25    */
addOnModeChangeListener(@onNull ServiceAware.OnModeChangeListener listener)26   void addOnModeChangeListener(@NonNull ServiceAware.OnModeChangeListener listener);
27 
28   /**
29    * Removes the given {@code listener}, which was previously added with
30    * {@link #addOnModeChangeListener(OnModeChangeListener)}.
31    */
removeOnModeChangeListener(@onNull ServiceAware.OnModeChangeListener listener)32   void removeOnModeChangeListener(@NonNull ServiceAware.OnModeChangeListener listener);
33 }
34