Flutter:将应用程序作为后台服务运行 [英] Flutter : Run an app as a background service

查看:1176
本文介绍了Flutter:将应用程序作为后台服务运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在用户断开蜂窝电话连接时显示自定义弹出消息.问题是如何检测应用程序何时未运行.任何线索都将有所帮助.

I want to show a custom popup message whenever the user disconnects a cellular call. The problem is how to detect when the app is not running. any leads would be helpful.

推荐答案

已经有一段时间了,并且已经有了很多发展.

It's been a while and there have been many developments.

首先,在此外, flutter/Background进程基本上会指向您中/执行Dart Flutter插件和地理围栏在后台显示(2018年9月)

Also, flutter/Background processes will basically point you to medium/Executing Dart in the Background with Flutter Plugins and Geofencing (Sept 2018)

  • which is a Geofencing sample that involves a partnership between isolates, native Android/iOS code via MethodChannel, and PluginUtilities.getCallbackHandle (PluginUtilities)

A,现在有很多插件可用:

Alas, there are many plugins available now:

  • https://pub.dev/packages/background_location
  • https://pub.dev/packages/android_alarm_manager (Android)
  • https://pub.dev/packages/background_fetch
  • https://pub.dev/packages/workmanager
  • https://pub.dev/packages/audio_service

这篇关于Flutter:将应用程序作为后台服务运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆