@supernotes/capacitor-app-actions
TypeScript icon, indicating that this package has built-in type declarations

6.0.3 • Public • Published


App Actions

capacitor-app-actions

Capacitor iOS and Android Plugin for App Actions


[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors-)

Installation

npm install capacitor-app-actions
npx cap sync

Configuration

Android

No additional configuration required.

iOS

Add the following to AppDelegate.swift. This snippet allows the plugin to recognize when an app action has been selected so that you can respond to those events.

func application(_ application: UIApplication,
                   performActionFor shortcutItem: UIApplicationShortcutItem,
                   completionHandler: @escaping (Bool) -> Void)
{
    NotificationCenter.default.post(name: NSNotification.Name("appActionReceived"), object: nil, userInfo: ["actionId" : shortcutItem.type])
}

Usage

Typically app actions are added at application startup, but you can add them where appropriate:

import { AppActions } from 'capacitor-app-actions'

await Capacitor.Plugins.AppActions.set({ "actions": [ 
  { id: "order", title: "Order", subtitle: "Place an Order", icon: "star.fill" }, 
  { id: "locations", title: "Find location", subtitle: "Find nearby location", icon: "star.fill"}
]});

Listen to an event triggered by an existing app action:

AppActions.addListener("order", (info) => {
  // Do your in app work. Navigate to the appropriate page or trigger other in app actions.
});

// clean up listeners when you are done
AppActions.removeAllListeners()

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Nitish Sachar

🚧 💻

Connor

🚧

Tobias

🚧

This project follows the all-contributors specification. Contributions of any kind welcome!

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
6.0.33latest

Version History

VersionDownloads (Last 7 Days)Published
6.0.33
6.0.20
6.0.10

Package Sidebar

Install

npm i @supernotes/capacitor-app-actions

Weekly Downloads

3

Version

6.0.3

License

MIT

Unpacked Size

26.8 kB

Total Files

29

Last publish

Collaborators

  • acnebs
  • tobeagram