Skip to content

Simple intent tools for Capacitor on Android platform.

Notifications You must be signed in to change notification settings

fetttttjoe/capacitor-intents

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

63 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

capacitor-intents-android

Simple intent tools for Capacitor on Android platform.

Install

npm install capacitor-intents-android
npx cap sync

Usage

See example-app in packages folder.

Simple Example Zebra Device

Register Listener:

CapacitorIntents.registerBroadcastReceiver({
    filters: ['com.your.custom.action', 'com.symbol.datawedge.api.RESULT_ACTION'],
    categories: ['android.intent.category.DEFAULT']
    },
    // Callback function
    (intent) => {
        console.log('Received Intent: ', intent.extras);
    })

CapacitorIntents.sendBroadcastIntent({ 
    action: 'com.your.custom.action', 
    // You can add as many extra Key : Value Pairs as Needed
    extras: {
        "com.symbol.datawedge.api.SOFT_SCAN_TRIGGER":   "TOGGLE_SCANNING"
        }
    })
    .then(
        (result) => {
            console.log('sendCommand: ', result);
        }
    );

API

registerBroadcastReceiver(...)

registerBroadcastReceiver(options: { filters: string[]; }, callback: (data: { [key: string]: any; }) => void) => any
Param Type
options { filters: {}; }
callback (data: { [key: string]: any; }) => void

Returns: any


unregisterBroadcastReceiver(...)

unregisterBroadcastReceiver(options: { id: string; }) => any
Param Type
options { id: string; }

Returns: any


sendBroadcastIntent(...)

sendBroadcastIntent(options: { action: string; extras: { [key: string]: any; }; }) => any
Param Type
options { action: string; extras: { [key: string]: any; }; }

Returns: any


About

Simple intent tools for Capacitor on Android platform.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 38.5%
  • TypeScript 30.4%
  • CSS 25.0%
  • HTML 3.3%
  • JavaScript 2.8%