Comments (3)
For your 4th feature request - this is already implemented! It's called "subtext". Use as follows:
void main() {
runApp(MyApp());
startForegroundService();
// if you need to stop foreground service,
// await FlutterForegroundPlugin.stopForegroundService();
}
void startForegroundService() async {
await FlutterForegroundPlugin.setServiceMethodInterval(seconds: 5);
await FlutterForegroundPlugin.setServiceMethod(globalForegroundService);
await FlutterForegroundPlugin.startForegroundService(
holdWakeLock: false,
onStarted: () {
print("Foreground on Started");
},
onStopped: () {
print("Foreground on Stopped");
},
title: "Flutter Foreground Service",
content: "This is Content",
iconName: "ic_stat_hot_tub",
subtext: "JCKodel",
);
}
void globalForegroundService() {
debugPrint("current datetime is ${DateTime.now()}");
}
Though there is a little bug in the current plugin code - I'll create a pull request shortly and edit my answer here.
Edit: See #11
from flutter_foreground_service_plugin.
This is the "little" bug?
from flutter_foreground_service_plugin.
Yes, IMHO this is a little bug since it is really easy to find and fix. Got really some other kind of issues with some other plugins :-)
I already created a pull request, so feel free to integrate this in your copy of the plugin.
from flutter_foreground_service_plugin.
Related Issues (20)
- Cant call the plugin from an isolate
- Call old data on re run foreground
- java.lang.RuntimeException: Unable to start service changjoopark.com.flutter_foreground_plugin.FlutterForegroundService@34e8f12 with null: java.lang.NullPointerException: Attempt to invoke virtual method 'java.lang.String android.content.Intent.getAction()' on a null object reference HOT 4
- Stops when back button is pressed HOT 7
- Close notification HOT 3
- Example throws an error HOT 8
- Not working when App is killed HOT 4
- How to call function when click stop button
- How do i customize the notification design?
- error: FlutterForegroundPlugin() has private access in FlutterForegroundPlugin HOT 1
- FlutterForegroundPlugin.java uses or overrides a deprecated API HOT 3
- Crash when using flutter_record_screen HOT 4
- The prefix "tools" for attribute "tools:overrideLibrary" associated with an element type "uses-sdk" is not bound. HOT 4
- Add attribute needed to stop service when app is killed to documentation
- FlutterForegroundPlugin is private, can't be create by Generated file. HOT 3
- How do I use infinite interval on configurations ?
- Not working when the app is killed. HOT 1
- Dynamically update notification content?
- [Question] Plugin/Repo still active and maintained?
- FlutterForegroundService.onStartCommand(FlutterForegroundService.java:36) HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_foreground_service_plugin.