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.support.annotation.NonNull; 8 9 /** 10 * A {@link FlutterPlugin} that wants to know when it is running within a {@link Service}. 11 */ 12 public interface ServiceAware { 13 /** 14 * Callback triggered when a {@code ServiceAware} {@link FlutterPlugin} is associated with a 15 * {@link Service}. 16 */ onAttachedToService(@onNull ServicePluginBinding binding)17 void onAttachedToService(@NonNull ServicePluginBinding binding); 18 19 /** 20 * Callback triggered when a {@code ServiceAware} {@link FlutterPlugin} is detached from a 21 * {@link Service}. 22 */ onDetachedFromService()23 void onDetachedFromService(); 24 25 interface OnModeChangeListener { 26 /** 27 * Callback triggered when the associated {@link Service} goes from background execution to 28 * foreground execution. 29 */ onMoveToForeground()30 void onMoveToForeground(); 31 32 /** 33 * Callback triggered when the associated {@link Service} goes from foreground execution to 34 * background execution. 35 */ onMoveToBackground()36 void onMoveToBackground(); 37 } 38 } 39