3

I'm building an app that receives GPS signals every five seconds, and I know that these background service apps shut down on their own.

  1. If background service is not available on Android OS, how does it work a service like Uber?

  2. I heard the Programmer can register a whitelist that doesn't automatically close even if the app resides in the background. How can I register whitelist?

Samet ÖZTOPRAK
  • 3,112
  • 3
  • 32
  • 33
ZUCCA
  • 101
  • 1
  • 7

1 Answers1

0

I am make a background servcie in flutter like this way right now:

/// The entry of dart background service
/// NOTE: this method will be invoked by native (Android/iOS)
/// avoid Tree Shaking
@pragma('vm:entry-point')
void playerBackgroundService() {
  CommonUtils.initialApp(ConfigType.PRO).whenComplete(() => {
    loadRepository()
  });
}

void loadRepository() {
  WidgetsFlutterBinding.ensureInitialized();
  GlobalConfig.init(ConfigType.PRO);
  netRepository = Repository();
  runBackgroundService(
    imageLoadInterceptor: BackgroundInterceptors.loadImageInterceptor,
  );
}

hop this help for you.

Dolphin
  • 29,069
  • 61
  • 260
  • 539