All Projects → robingenz → capacitor-background-task

robingenz / capacitor-background-task

Licence: MIT License
⚡️ Capacitor plugin for running background tasks.

Programming Languages

swift
15916 projects
java
68154 projects - #9 most used programming language
typescript
32286 projects
ruby
36898 projects - #4 most used programming language
objective c
16641 projects - #2 most used programming language
javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to capacitor-background-task

capacitor-android-dark-mode-support
⚡️ Capacitor plugin to support dark mode on Android.
Stars: ✭ 23 (-14.81%)
Mutual labels:  capacitor, capacitor-plugin, capacitor-android, capacitor-community
keep-awake
⚡️ Capacitor plugin to prevent devices from dimming or locking the screen.
Stars: ✭ 69 (+155.56%)
Mutual labels:  capacitor, capacitor-plugin, capacitor-community
text-to-speech
⚡️ Capacitor plugin for synthesizing speech from text.
Stars: ✭ 50 (+85.19%)
Mutual labels:  capacitor, capacitor-plugin, capacitor-community
XREngine
Immersive infrastructure for everyone. Everything you need to build and deploy scalable realtime 3D social apps and more. 🤖 🚀 👓 🚀 🕹️ 🚀 🧑🏿‍🚀
Stars: ✭ 423 (+1466.67%)
Mutual labels:  capacitor, capacitor-plugin
capacitor-vue-ionicv4-app
sample app using capacitor vuejs and ionicv4 components
Stars: ✭ 70 (+159.26%)
Mutual labels:  capacitor, capacitor-plugin
app-icon
Capacitor plugin for managing an app's icon. The main feature being that you can programmatically change the app icon.
Stars: ✭ 28 (+3.7%)
Mutual labels:  capacitor, capacitor-plugin
capacitor-rate-app
Let users rate your app using native review app dialog for both Android and iOS.
Stars: ✭ 88 (+225.93%)
Mutual labels:  capacitor, capacitor-plugin
capacitor-site
Capacitor website
Stars: ✭ 0 (-100%)
Mutual labels:  capacitor, capacitor-plugin
capacitor-branch-deep-links
Capacitor plugin for branch.io deep links
Stars: ✭ 22 (-18.52%)
Mutual labels:  capacitor, capacitor-plugin
appcenter-sdk-capacitor
Capacitor Plugin for Microsoft's Visual Studio App Center SDK.
Stars: ✭ 22 (-18.52%)
Mutual labels:  capacitor, capacitor-plugin
capacitor-firebase-authentication
⚡️ Capacitor plugin for Firebase Authentication.
Stars: ✭ 67 (+148.15%)
Mutual labels:  capacitor, capacitor-plugin
capacitor-filesharer
Capacitor plugin to download and share files for the Web, Android and iOS! Stop the war in Ukraine!
Stars: ✭ 55 (+103.7%)
Mutual labels:  capacitor, capacitor-plugin
firebase-crashlytics
⚡️ Capacitor plugin for Firebase Crashlytics.
Stars: ✭ 63 (+133.33%)
Mutual labels:  capacitor, capacitor-community
larasar
Laravel + Quasar Framework
Stars: ✭ 77 (+185.19%)
Mutual labels:  capacitor
ionic-vue-mobile-template-01
Hybrid app template built with vue, ionic and capacitor.
Stars: ✭ 47 (+74.07%)
Mutual labels:  capacitor
native-xr-for-web
Add iOS and Android build with AR capabilities to your website or web-based app.
Stars: ✭ 27 (+0%)
Mutual labels:  capacitor
IonicMadrid
Charlas Ionic Madrid
Stars: ✭ 14 (-48.15%)
Mutual labels:  capacitor
FhemNative
Cross Platform FHEM-HomeAutomation Frontend
Stars: ✭ 14 (-48.15%)
Mutual labels:  capacitor
v-cupertino
A Vue 3 Wrapper for Cupertino Pane Library
Stars: ✭ 17 (-37.04%)
Mutual labels:  capacitor
create-capacitor-plugin
Create a new Capacitor plugin ⚡️
Stars: ✭ 44 (+62.96%)
Mutual labels:  capacitor


Background Task

@robingenz/capacitor-background-task

Capacitor plugin for running background tasks.


Maintainers

Maintainer GitHub Social
Robin Genz robingenz @robin_genz

Installation

npm install @robingenz/capacitor-background-task
npx cap sync

Configuration

No configuration required for this plugin.

Demo

A working example can be found here: robingenz/capacitor-plugin-demo

Usage

import { App } from '@capacitor/app';
import { BackgroundTask } from '@robingenz/capacitor-background-task';

App.addListener('appStateChange', async ({ isActive }) => {
  if (isActive) {
    return;
  }
  // The app state has been changed to inactive.
  // Start the background task by calling `beforeExit`.
  const taskId = await BackgroundTask.beforeExit(async () => {
    // Run your code...
    // Finish the background task as soon as everything is done.
    BackgroundTask.finish({ taskId });
  });
});

API

beforeExit(...)

beforeExit(cb: () => void) => Promise<CallbackID>

Call this method when the app moves to the background. It allows the app to continue running a task in the background.

On iOS this method should be finished in less than 30 seconds.

Only available for Android and iOS.

Param Type
cb () => void

Returns: Promise<string>


finish(...)

finish(options: FinishOptions) => void

Finish the current background task. The OS will put the app to sleep.

Only available for Android and iOS.

Param Type
options FinishOptions

Interfaces

FinishOptions

Prop Type
taskId CallbackID

Type Aliases

CallbackID

string

Quirks

iOS

On iOS the UIKit framework is used. Read more about the implementation and any limitations here.

Android

There is currently no ready implementation on Android. It's planned to add the support in the near future.

Changelog

See CHANGELOG.md.

License

See LICENSE.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].