Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
capacitor-fullscreen-notification
Advanced tools
Readme
This plugin can automatically launch your app, triggered by a data push notification by the @capacitor/push-notifications plugin.
Use case example: Someone rings your doorbell -> your app opens and navigates to a specific route
Platform | Supported |
---|---|
Android | ✔ |
iOS | ✖ |
Web | ✖ |
npm install capacitor-fullscreen-notification
npx cap sync android
Add this to the activity inside your AndroidManifest.xml:
android:showWhenLocked="true"
android:turnScreenOn="true"
The Android OS differs between an locked and unlocked device.
The app will only be launched instantly, when your device is in standby.
If your device is not in standby, you will get a default heads up notification with the defined title, text and actionButtons. When you click on it, the app will launch.
HINT
To identify if the app has been launched instantly or by clicking the heads up notification, you can check the property 'isNotificationActive' in the response data of your 'launch' listener. This is true on instant launch.
This plugin will start a fullscreen intent by a local notification, when it receives a specific data push notification.
Firebase |
---|
1. Send a data push |
Plugin |
---|
2. Receives the data push |
3. Sends a local notification with full screen intent (opens app) |
4. Emits a plugin event |
App |
---|
5. Listen to event and redirect to any page |
Send a data push notification (leave the field notification empty!) with the following key value pairs in the data option:
Option | Description |
---|---|
fullScreenId | (Required) Identifier of the fullscreen notification |
channelId | Identifier of the notification channel |
channelName | Name of the notification channel |
channelDescription | Description of the notification channel |
title | Title of the heads up notification |
text | Text of the heads up notification |
timeout | Timeout, for auto removing the notification |
vibrationPattern | Stringified array of long values (docs) |
actionButtons | Stringified array of ActionButton objects |
Prop | Description |
---|---|
id | Identifier of the button |
text | Button text |
{
"fullScreenId": "my-fullscreen-identifier",
"channelId": "fullscreen-channel",
"channelName": "My Fullscreen Channel",
"channelDescription": "Notifications in this channel will be displayed with a fullscreen intent",
"title": "Test notification",
"text": "Test description",
"timeout": "10000",
"vibrationPattern": "[500, 300, 500, 300, 500, 300, 500, 300]",
"actionButtons": "[{ \"id\": \"reject\", \"text\": \"Reject\" }, { \"id\": \"accept\", \"text\": \"Accept\" }]"
}
In your app, you can listen to the launch of the application. This event is fired when the fullscreen notification opens or the heads up notification is clicked. You can also cancel the active notification, if it exists:
import { FullScreenNotification } from 'capacitor-fullscreen-notification';
FullScreenNotification.addListener('launch', (data) => {
...
});
...
await FullScreenNotification.cancelNotification();
Inside the data of the launch event, you can have the following data:
Prop | Type | Description |
---|---|---|
fullScreenId | string | Identifier of the triggering request |
isNotificationActive | boolean | Is the notification still active |
timeout | number | (Optionally) Timeout value of the triggering request |
actionId | string | (Optionally) Idenfifier of the clicked action button |
cancelNotification() => any
Cancel the current notification
Returns: any
addListener(eventName: 'launch', listenerFunc: MessageListener) => Promise<PluginListenerHandle> & PluginListenerHandle
Add a listener when the fullscreen intent launches the app. You can navigate here to the destination page. The parameter gives you the information if an action button has been clicked.
Param | Type |
---|---|
eventName | 'launch' |
listenerFunc | MessageListener |
Returns: any
removeAllListeners() => any
Removes all listeners.
Returns: any
Prop | Type |
---|---|
remove | () => any |
(response: any): void
FAQs
Start a fullscreen intent with a local notification triggered by a push notification
The npm package capacitor-fullscreen-notification receives a total of 24 weekly downloads. As such, capacitor-fullscreen-notification popularity was classified as not popular.
We found that capacitor-fullscreen-notification demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer 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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.