npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@techrover_solutions/capacitor-fullscreen-notification

v0.0.1

Published

Start a fullscreen intent with a local notification triggered by a push notification

Downloads

2

Readme

A fork from https://www.npmjs.com/package/capacitor-fullscreen-notification With custom features for Techrover Solutions internal use

Author: Deval99

npm version capacitor support

capacitor-fullscreen-notification

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

Supported platforms

| Platform | Supported | | -------- | --------: | | Android | ✔ | | iOS | ✖ | | Web | ✖ |

Install

npm install capacitor-fullscreen-notification
npx cap sync android

Add this to the activity inside your AndroidManifest.xml:

android:showWhenLocked="true"
android:turnScreenOn="true"

Android behavior

The Android OS differs between an locked and unlocked device.

Locked

The app will only be launched instantly, when your device is in standby.

Unlocked

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.

Workflow

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 |

Usage

Trigger push

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 |

ActionButton

| Prop | Description | | ---------- | ------------------------ | | id | Identifier of the button | | text | Button text |

Example

{
  "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\" }]"
}

App

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 |

API

cancelNotification()

cancelNotification() => Promise<void>

Cancel the current notification


addListener('launch', ...)

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: Promise<PluginListenerHandle> & PluginListenerHandle


removeAllListeners()

removeAllListeners() => Promise<void>

Removes all listeners.


Interfaces

PluginListenerHandle

| Prop | Type | | ------------ | ----------------------------------------- | | remove | () => Promise<void> |

Type Aliases

MessageListener

(response: any): void