Socket
Socket
Sign inDemoInstall

capacitor-android-shortcuts

Package Overview
Dependencies
2
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.0 to 1.0.1

2

package.json
{
"name": "capacitor-android-shortcuts",
"version": "1.0.0",
"version": "1.0.1",
"description": "Add shortcuts in Android",

@@ -5,0 +5,0 @@ "main": "dist/plugin.cjs.js",

[![npm version](https://badge.fury.io/js/capacitor-android-shortcuts.svg)](https://badge.fury.io/js/capacitor-android-shortcuts)
[![capacitor support](https://img.shields.io/badge/capacitor%20support-v3-brightgreen?logo=capacitor)](https://capacitorjs.com/)
# capacitor-android-shortcuts
This plugin provides the feature to add a dynamic and pinned shortcut in Android apps. See more [in the Android docs](https://developer.android.com/guide/topics/ui/shortcuts).
This plugin provides the feature to add dynamic and pinned shortcuts in Android apps. See more [in the Android docs](https://developer.android.com/guide/topics/ui/shortcuts). Its possible to listen to a shortcut tap action with an event listener (see `Usage`).
**Dynamic shortcut**<br/>
Tap and hold on the app icon and you will see the dynamic shortcuts in the dropdown<br/>
=> Usage: Call the `addDynamic` method one time to add the array of dynamic shortcuts
**Pinned shortcut**<br/>
You can add a pinned shortcut programmatically inside your app, i.e. let a customer add a favorite of an article/product/... to the home screen<br/>
=> Usage: Call the `addPinned` method where the user wants to pin something. An alert will be shown to add the pinned shortcut to the home screen.
## Supported platforms

@@ -30,37 +39,40 @@

// Add dynamic shortcuts
if (AndroidShortcuts.isDynamicSupported()) {
AndroidShortcuts.addDynamic({
items: [
{
id: 'myfirstid',
shortLabel: 'My first short label',
longLabel: 'My first long label',
iconBitmap: 'BASE64DATA',
data: 'I am a simple string'
},
{
id: 'mysecondid',
shortLabel: 'My first short label',
longLabel: 'My first long label',
iconBitmap: 'BASE64DATA',
data: JSON.stringify({ myProperty: 'Pass a stringified JSON object' })
},
],
});
}
AndroidShortcuts.isDynamicSupported().then(({ result }) => {
if (result) {
AndroidShortcuts.addDynamic({
items: [
{
id: "myfirstid",
shortLabel: "My first short label",
longLabel: "My first long label",
iconBitmap: "BASE64DATA",
data: "I am a simple string",
},
{
id: "mysecondid",
shortLabel: "My first short label",
longLabel: "My first long label",
iconBitmap: "BASE64DATA",
data: JSON.stringify({
myProperty: "Pass a stringified JSON object",
}),
},
],
});
}
});
...
// Add pinned shortcuts
if (AndroidShortcuts.isDynamicSupported()) {
AndroidShortcuts.addPinned(
{
id: 'mypinnedid',
shortLabel: 'My pinned short label',
longLabel: 'My pinned long label',
iconBitmap: 'BASE64DATA',
data: 'I am a simple string'
}
});
}
AndroidShortcuts.isPinnedSupported().then(({ result }) => {
if (result) {
AndroidShortcuts.addPinned({
id: "mypinnedid",
shortLabel: "My pinned short label",
longLabel: "My pinned long label",
iconBitmap: "BASE64DATA",
data: "I am a simple string",
});
}
});

@@ -73,3 +85,3 @@ // Triggered when app is launched by a shortcut

See also [Wiki: Icon Example](https://github.com/NePheus/capacitor-android-shortcuts/wiki/Icon-Example)
See also [Wiki: Icon examples](https://github.com/NePheus/capacitor-android-shortcuts/wiki/Icon-examples)

@@ -76,0 +88,0 @@ ## API

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc