{"id":16439514,"url":"https://github.com/changjoo-park/flutter_foreground_service_plugin","last_synced_at":"2025-03-16T17:36:22.970Z","repository":{"id":36024926,"uuid":"220434708","full_name":"ChangJoo-Park/flutter_foreground_service_plugin","owner":"ChangJoo-Park","description":null,"archived":false,"fork":false,"pushed_at":"2023-05-03T06:36:08.000Z","size":189,"stargazers_count":39,"open_issues_count":23,"forks_count":73,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-10T15:20:00.403Z","etag":null,"topics":["android","flutter","flutter-plugin","foreground-service"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ChangJoo-Park.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-11-08T09:39:05.000Z","updated_at":"2025-01-06T02:55:16.000Z","dependencies_parsed_at":"2024-06-19T01:40:09.862Z","dependency_job_id":"8998b144-f51b-487b-a36a-5cce70617ad6","html_url":"https://github.com/ChangJoo-Park/flutter_foreground_service_plugin","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChangJoo-Park%2Fflutter_foreground_service_plugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChangJoo-Park%2Fflutter_foreground_service_plugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChangJoo-Park%2Fflutter_foreground_service_plugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ChangJoo-Park%2Fflutter_foreground_service_plugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ChangJoo-Park","download_url":"https://codeload.github.com/ChangJoo-Park/flutter_foreground_service_plugin/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243823594,"owners_count":20353697,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","flutter","flutter-plugin","foreground-service"],"created_at":"2024-10-11T09:09:35.846Z","updated_at":"2025-03-16T17:36:22.516Z","avatar_url":"https://github.com/ChangJoo-Park.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"# flutter_foreground_service_plugin\n\n## You Can Do this plugin with..\n\n- Start Foreground Service (with callback)\n- Stop Foreground Service (with callback)\n- Using infinite interval on your configurations\n- Change Notification title and contents\n\n## You Can Not Do this plugin with...\n\n- [ ] Change Notification Level\n\n\n\n## If you use this plugin.\n\n1. Add dependency to your pubspec.yaml\n\n\n```yaml\ndependencies:\n    ...\n\n  flutter_foreground_plugin: ^0.4.0\n```\n\n\n2. Add permission for ForegroundService to AndroidManifest.xml\n\n```xml\n\u003cuses-permission android:name=\"android.permission.FOREGROUND_SERVICE\"/\u003e\n```\n\n\n3. Add service for ForegroundService to AndroidManifest.xml below `\u003c/activity\u003e`\n\n```xml\n\u003cservice android:name=\"changjoopark.com.flutter_foreground_plugin.FlutterForegroundService\"/\u003e\n```\n\n4. Add use-sdk under `application`\n\n```\n    \u003cuses-sdk\n        android:minSdkVersion=\"23\"\n        tools:overrideLibrary=\"changjoopark.com.flutter_foreground_plugin\" /\u003e\n```\n\n5. Add icon image for notification.\n\n[Notification Icon Generator](https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=clipart\u0026source.clipart=ac_unit\u0026source.space.trim=1\u0026source.space.pad=0\u0026name=ic_stat_ac_unit) will be helpful.\n\npath: `android/app/src/main/res/drawable-*`\n\n5. Write code for foreground service\n\n```dart\nvoid main() {\n  runApp(MyApp());\n  startForegroundService();\n\n  // if you need to stop foreground service,\n  // await FlutterForegroundPlugin.stopForegroundService();\n}\n\nvoid startForegroundService() async {\n  await FlutterForegroundPlugin.setServiceMethodInterval(seconds: 5);\n  await FlutterForegroundPlugin.setServiceMethod(globalForegroundService);\n  await FlutterForegroundPlugin.startForegroundService(\n    holdWakeLock: false,\n    onStarted: () {\n      print(\"Foreground on Started\");\n    },\n    onStopped: () {\n      print(\"Foreground on Stopped\");\n    },\n    title: \"Flutter Foreground Service\",\n    content: \"This is Content\",\n    iconName: \"ic_stat_hot_tub\",\n  );\n}\n\nvoid globalForegroundService() {\n  debugPrint(\"current datetime is ${DateTime.now()}\");\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchangjoo-park%2Fflutter_foreground_service_plugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fchangjoo-park%2Fflutter_foreground_service_plugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fchangjoo-park%2Fflutter_foreground_service_plugin/lists"}