Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
cordova-plugin-background-app
Advanced tools
The purpose of this plugin is to enable notifications, alarms, etc to re-start your app and fire callbacks without the app causing any visual cues to the user. In essense, it allows starting an app as an Android service, but does so without the use of an
The purpose of this plugin is to enable notifications, alarms, etc to re-start your app and fire callbacks without the app causing any visual cues to the user. In essense, it allows starting an app as an Android service, but does so without the use of an actual service.
Works on iOS and Android.
iOS values for resumeType limited to: ''
, 'launch'
, 'normal'
, 'normal-launch'
To see it in action, try the example app.
For how to create your own plugin that uses it, look at cordova-plugin-chrome-apps-notifications or cordova-plugin-chrome-apps-alarms
cordova.backgroundapp.resumeType
(string)After the deviceready
event, this will either be:
''
- When started as a service.'launch'
- When started normally.After a resume
event, this will be one of:
'normal'
- Triggered by an external intent (launcher / task switcher). App was running normally, but had been backgrounded.'normal-launch'
- Triggered by an external intent (launcher / task switcher). App was running as a service.'programmatic'
- Triggered by a call to BackgroundActivity.launchForeground()
. App was running normally, but had been backgrounded.'programmatic-launch'
- Triggered by a call to `BackgroundActivity. App was running as a service.The normal way to use this plugin:
document.addEventListener("deviceready", function() {
if (cordova.backgroundapp.resumeType == 'launch') {
renderUi();
}
}, false);
document.addEventListener("resume", function() {
if (cordova.backgroundapp.resumeType == 'normal-launch') {
renderUi();
} else if (cordova.backgroundapp.resumeType == 'programmatic-launch') {
// You launched programatically (through cordova.backgroundapp.show() perhaps)
// so you should have already called renderUi() from where you called .show().
}
}, false);
cordova.backgroundapp.show()
Brings the app to the foreground. E.g. Call this in response to a user clicking on a notification.
This symbol will be null on iOS, since iOS has not yet implemented this functionality.
The goal is ultimately to be able to run the app in an Android service, but because many plugins utilize CordovaInterface.getActivity(), a background Activity rather than a Service is more viable.
<intent-filter>
BackgroundLauncherActivity
to recieve launch intent and start your main activity.<activity-alias>
to make your
previous main activity point to BackgroundLauncherActivity
, and then rename your
main activity to not conflict with the alias. This is so that
launcher shortcuts
continue to function correctly.cordova.backgroundapp.resumeType
being 'launch'
when running in background on Androidcordova.backgroundapp.resumeType
and cordova.backgroundapp.show()
resumeType
values only)FAQs
The purpose of this plugin is to enable notifications, alarms, etc to re-start your app and fire callbacks without the app causing any visual cues to the user. In essense, it allows starting an app as an Android service, but does so without the use of an
We found that cordova-plugin-background-app demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.