### Complete AWS Amplify CI/CD Configuration for Private Packages Source: https://capawesome.io/plugins/speech-recognition/insiders/getting-started An example of a full `amplify.yml` file demonstrating how to set up your AWS Amplify CI/CD environment to install Capawesome private packages. It includes the `preBuild` phase for configuring the npm registry and the `build` phase for running your application's build commands. ```YAML version: 1 frontend: phases: preBuild: commands: - echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc - echo "//npm.registry.capawesome.io/:_authToken=${CAPAWESOME_NPM_REGISTRY_TOKEN}" >> .npmrc - npm ci build: commands: - npm run build artifacts: baseDirectory: dist files: - '**/*' ``` -------------------------------- ### Install Capawesome CLI for Live Update Publishing Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Command to globally install the Capawesome CLI, which is required to publish live updates to Capawesome Cloud. ```shell npm install -g @capawesome/cli@latest ``` -------------------------------- ### Install Capawesome Private Plugin Source: https://capawesome.io/plugins/speech-recognition/insiders/getting-started After configuring the npm registry, use this command to install a specific private Capawesome plugin. Follow up with `npx cap sync` to ensure Capacitor projects are properly synchronized with the new plugin. ```Shell npm install @capawesome-team/ npx cap sync ``` -------------------------------- ### Install Capawesome Capacitor Live Update Plugin Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Installs the necessary Capawesome Capacitor Live Update plugin into your project using npm. This is the first step to enable live update functionality. ```shell npm install @capawesome/capacitor-live-update ``` -------------------------------- ### Initialize New npm Project Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor Initializes a new npm project in the current directory, creating a `package.json` file to manage project metadata and dependencies. ```Shell npm init ``` -------------------------------- ### Install Ionic CLI Globally Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor This command installs the Ionic Command Line Interface globally on your system, allowing you to create and manage Ionic and Capacitor projects. ```npm npm i -g @ionic/cli ``` -------------------------------- ### Install Capacitor Firebase Cloud Messaging Plugin Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor These commands install the Capacitor Firebase Cloud Messaging plugin and the Firebase core package, then synchronize the Capacitor project to integrate the new plugins. ```npm npm install @capacitor-firebase/messaging firebase npx ionic cap sync ``` -------------------------------- ### Capawesome Capacitor LiveUpdate Plugin API Reference Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Reference for the core methods of the @capawesome/capacitor-live-update plugin, enabling advanced control over the live update process. ```APIDOC LiveUpdate: fetchLatestBundle(): Promise<{ bundleId?: string; downloadUrl?: string; }> Description: Checks for new bundles without downloading them. Returns: A Promise resolving to an object containing 'bundleId' and 'downloadUrl' if an update is available. downloadBundle(options: { bundleId: string; }): Promise Description: Downloads a specified bundle, extracts files, and moves them to the correct app location. Parameters: bundleId: string - The ID of the bundle to download. Returns: A Promise that resolves when the download is complete. setNextBundle(options: { bundleId: string; }): Promise Description: Sets a new bundle as the next bundle to be applied. Parameters: bundleId: string - The ID of the bundle to set as the next bundle. Returns: A Promise that resolves when the bundle is set. reload(): Promise Description: Applies the currently set new bundle immediately by reloading the app. Returns: A Promise that resolves when the app reloads. ``` -------------------------------- ### Apply Live Update Immediately with Capawesome Capacitor Plugin Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Demonstrates how to use the `reload()` method from `@capawesome/capacitor-live-update` to immediately apply the currently set next bundle, refreshing the app. ```typescript import { LiveUpdate } from "@capawesome/capacitor-live-update"; const reload = async () => { await LiveUpdate.reload(); }; ``` -------------------------------- ### Configure Capawesome npm Registry for Private Packages Source: https://capawesome.io/plugins/speech-recognition/insiders/getting-started Configure your local npm environment to access Capawesome's private package registry. This involves setting the registry URL and providing your unique license key as an authentication token. Remember to replace the placeholder with your actual key. ```Shell npm config set @capawesome-team:registry https://npm.registry.capawesome.io npm config set //npm.registry.capawesome.io/:_authToken ``` -------------------------------- ### Sync Capacitor Project After Plugin Installation Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Synchronizes your Capacitor project to ensure the newly installed Live Update plugin is properly registered and available for use across native platforms. ```shell npx cap sync ``` -------------------------------- ### Build Web Application for Capawesome Live Update Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Provides the command to build the web application, creating a bundle artifact (e.g., `dist` or `www` folder) which contains the updated files for a live update. ```shell npm run build ``` -------------------------------- ### Capacitor Posthog Plugin Usage Examples Source: https://capawesome.io/plugins/speech-recognition/plugins/posthog Demonstrates how to use various methods of the @capawesome/capacitor-posthog plugin, including event capturing, user identification, property management, and plugin setup. ```TypeScript import { Posthog } from '@capawesome/capacitor-posthog'; const alias = async () => { await Posthog.alias({ alias: 'new-distinct-id', }); }; const capture = async () => { await Posthog.capture({ event: 'event', properties: { key: 'value', }, }); }; const flush = async () => { await Posthog.flush(); }; const group = async () => { await Posthog.group({ type: 'group', key: 'key', groupProperties: { key: 'value', }, }); }; const identify = async () => { await Posthog.identify({ distinctId: 'distinct-id', userProperties: { key: 'value', }, }); }; const register = async () => { await Posthog.register({ key: 'super-property', value: 'super-value', }); }; const reset = async () => { await Posthog.reset(); }; const screen = async () => { await Posthog.screen({ screenTitle: 'screen', properties: { key: 'value', }, }); }; const setup = async () => { await Posthog.setup({ apiKey: 'YOUR_API_KEY', host: 'https://eu.i.posthog.com', }); }; const unregister = async () => { await Posthog.unregister({ key: 'super-property', }); }; ``` -------------------------------- ### Install Firebase Admin SDK Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor Installs the Firebase Admin SDK package into the current npm project. This package provides server-side functionalities for interacting with Firebase services. ```Shell npm i firebase-admin ``` -------------------------------- ### Install @capawesome/capacitor-screenshot plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/screenshot Instructions for installing the `@capawesome/capacitor-screenshot` plugin using npm and syncing with Capacitor, including an additional step for the Web platform to install `html2canvas`. ```shell npm install @capawesome/capacitor-screenshot npx cap sync ``` ```shell npm i html2canvas ``` -------------------------------- ### Set Next Live Update Bundle with Capawesome Capacitor Plugin Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Illustrates how to use the `setNextBundle()` method from `@capawesome/capacitor-live-update` to designate a downloaded bundle as the one to be applied next. ```typescript import { LiveUpdate } from "@capawesome/capacitor-live-update"; const setNextBundle = async (bundleId: string) => { await LiveUpdate.setNextBundle({ bundleId, }); }; ``` -------------------------------- ### Create New Live Update Bundle via Capawesome CLI Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Command to create and upload a new bundle to Capawesome Cloud using the Capawesome CLI, making it available as a live update for the app. ```shell npx @capawesome/cli apps:bundles:create ``` -------------------------------- ### Install Capacitor Wi-Fi plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/wifi Installs the `@capawesome-team/capacitor-wifi` package and synchronizes Capacitor native projects. ```npm npm install @capawesome-team/capacitor-wifi npx cap sync ``` -------------------------------- ### API: installGoogleSubjectSegmentationModule Method Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/subject-segmentation Initiates the installation of the Google Subject Segmentation module on Android. This only starts the installation process; the `googleSubjectSegmentationModuleInstallProgress` event listener will notify when the installation is complete. ```APIDOC installGoogleSubjectSegmentationModule() => Promise Description: Install the Google Subject Segmentation module. Attention: This only starts the installation. The `googleSubjectSegmentationModuleInstallProgress` event listener will notify you when the installation is complete. Only available on Android. Since: 7.2.0 ``` -------------------------------- ### Install Capacitor File Opener Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/file-opener Instructions to install the @capawesome-team/capacitor-file-opener plugin using npm and synchronize Capacitor native projects. ```npm npm install @capawesome-team/capacitor-file-opener npx cap sync ``` -------------------------------- ### Add iOS Platform to Capacitor Project Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor These commands install the Capacitor iOS package and add the iOS platform to your Capacitor project, enabling native iOS development. ```npm npm install @capacitor/ios npx cap add ios ``` -------------------------------- ### Install @capawesome/capacitor-app-shortcuts Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/app-shortcuts Instructions to install the Capacitor App Shortcuts plugin using npm and synchronize native projects. ```shell npm install @capawesome/capacitor-app-shortcuts npx cap sync ``` -------------------------------- ### Install Capacitor Managed Configurations Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/managed-configurations Installs the `@capawesome/capacitor-managed-configurations` plugin using npm and synchronizes it with the native Capacitor projects. ```bash npm install @capawesome/capacitor-managed-configurations npx cap sync ``` -------------------------------- ### Install Capacitor App Review Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/app-review Commands to install the `@capawesome/capacitor-app-review` plugin using npm and synchronize with Capacitor. ```npm npm install @capawesome/capacitor-app-review npx cap sync ``` -------------------------------- ### Download Live Updates with Capawesome Capacitor Plugin Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Shows how to use the `downloadBundle()` method from `@capawesome/capacitor-live-update` to download a specific bundle. This method handles downloading, extracting, and moving files to the correct app location. ```typescript import { LiveUpdate } from "@capawesome/capacitor-live-update"; const downloadUpdate = async (bundleId: string, url: string) => { await LiveUpdate.downloadBundle({ bundleId, }); }; ``` -------------------------------- ### Create New Capacitor Project with Ionic CLI Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor This command initializes a new Capacitor project using the Ionic CLI. It sets up a blank Angular project, enables Capacitor integration, and allows specifying a custom package ID. ```shell npx ionic start capacitor-firebase-messaging-demo blank --type=angular --capacitor --package-id=YOUR_PACKAGE_ID ``` -------------------------------- ### Add Android Platform to Capacitor Project Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor These commands install the Capacitor Android package and add the Android platform to your Capacitor project, enabling native Android development. ```npm npm install @capacitor/android npx cap add android ``` -------------------------------- ### Install @capawesome-team/capacitor-file-compressor plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/file-compressor Installs the Capacitor file compressor plugin and synchronizes it with the native projects. This command should be run after configuring the Capawesome npm registry. ```Shell npm install @capawesome-team/capacitor-file-compressor npx cap sync ``` -------------------------------- ### Capacitor Wifi Plugin Usage Examples Source: https://capawesome.io/plugins/speech-recognition/plugins/wifi Demonstrates how to use various functionalities of the Capacitor Wifi plugin, including connecting to and disconnecting from networks, retrieving available networks, getting IP address, RSSI, and SSID, checking Wi-Fi status, and initiating network scans. ```TypeScript import { Wifi } from '@capawesome-team/capacitor-wifi'; const connect = async () => { await Wifi.connect({ ssid: 'MyNetwork', password: 'MyPassword', isHiddenSsid: false }); } const disconnect = async () => { await Wifi.disconnect(); } const getAvailableNetworks = async () => { const result = await Wifi.getAvailableNetworks(); return result.networks; } const getIpAddress = async () => { const result = await Wifi.getIpAddress(); return result.address; } const getRssi = async () => { const result = await Wifi.getRssi(); return result.rssi; } const getSsid = async () => { const result = await Wifi.getSsid(); return result.ssid; } const isEnabled = async () => { const result = await Wifi.isEnabled(); return result.enabled; } const startScan = async () => { await Wifi.startScan(); } ``` -------------------------------- ### Implement Basic Live Update Sync and Reload Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Demonstrates the fundamental usage of the Live Update plugin. It checks for available updates, downloads them, and then reloads the application to apply the new bundle immediately if an update is found. ```typescript import { LiveUpdate } from "@capawesome/capacitor-live-update"; const sync = async () => { const result = await LiveUpdate.sync(); if (result.nextBundleId) { await LiveUpdate.reload(); } }; ``` -------------------------------- ### Check for Live Updates with Capawesome Capacitor Plugin Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Demonstrates how to use the `fetchLatestBundle()` method from `@capawesome/capacitor-live-update` to check for new bundles without downloading them. It logs whether an update is available and its download URL. ```typescript import { LiveUpdate } from "@capawesome/capacitor-live-update"; const checkForUpdates = async () => { const result = await LiveUpdate.fetchLatestBundle(); if (result.bundleId) { console.log("New update available: " + result.downloadUrl); } else { console.log("No update available"); } }; ``` -------------------------------- ### Configure Capawesome npm Registry in GitHub Actions Workflow Source: https://capawesome.io/plugins/speech-recognition/insiders/getting-started This snippet demonstrates how to configure the Capawesome private npm registry within a GitHub Actions workflow. It involves adding a step to dynamically create or append to the .npmrc file, using a GitHub secret for the authentication token, before npm dependencies are installed. ```shell - name: Configure the Capawesome npm registry run: | echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc echo "//npm.registry.capawesome.io/:_authToken=${{ secrets.CAPAWESOME_NPM_REGISTRY_TOKEN }}" >> .npmrc ``` -------------------------------- ### Install Capacitor Background Task Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/background-task Instructions to install the @capawesome/capacitor-background-task plugin using npm and synchronize Capacitor assets. ```Shell npm install @capawesome/capacitor-background-task npx cap sync ``` -------------------------------- ### Sync Capacitor Project After Configuration Update Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/setup Synchronizes your Capacitor project after modifying the `capacitor.config.json` file. This step ensures that the updated plugin configuration is applied to your native project builds. ```shell npx cap sync ``` -------------------------------- ### Install Capacitor Photo Editor Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/photo-editor This snippet shows how to install the `@capawesome/capacitor-photo-editor` plugin using npm and synchronize it with Capacitor. ```Shell npm install @capawesome/capacitor-photo-editor npx cap sync ``` -------------------------------- ### Install Capacitor PostHog Plugin and Sync Source: https://capawesome.io/plugins/speech-recognition/plugins/posthog Installs the @capawesome/capacitor-posthog plugin and the official posthog-js library, then synchronizes the Capacitor project to apply changes across native platforms. ```Shell npm install @capawesome/capacitor-posthog posthog-js npx cap sync ``` -------------------------------- ### Install Capacitor Android Battery Optimization Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/android-battery-optimization Commands to install the `@capawesome-team/capacitor-android-battery-optimization` plugin using npm and synchronize Capacitor projects. ```shell npm install @capawesome-team/capacitor-android-battery-optimization npx cap sync ``` -------------------------------- ### Install Capawesome Capacitor File Picker Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/file-picker Installs the Capawesome Capacitor File Picker plugin and synchronizes native projects, making it available for use in Capacitor applications. ```shell npm install @capawesome/capacitor-file-picker npx cap sync ``` -------------------------------- ### Install Capacitor Asset Manager Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/asset-manager Installs the @capawesome/capacitor-asset-manager plugin and synchronizes native projects for Android and iOS. ```Shell npm install @capawesome/capacitor-asset-manager npx cap sync ``` -------------------------------- ### Open File with External App using Capacitor File Opener Source: https://capawesome.io/plugins/speech-recognition/blog/the-file-handling-guide-for-capacitor This example shows how to open a file with another application on the device using the `@capawesome-team/capacitor-file-opener` plugin. It takes a file path and attempts to open it with the appropriate default application. ```TypeScript import { FileOpener } from '@capawesome-team/capacitor-file-opener'; const openFile = async () => { await FileOpener.openFile({ path: 'file:///path/to/device/file', }); }; ``` -------------------------------- ### Install Capacitor Screen Orientation Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/screen-orientation This snippet provides the commands to install the @capawesome/capacitor-screen-orientation plugin using npm and synchronize it with your Capacitor project. ```Shell npm install @capawesome/capacitor-screen-orientation npx cap sync ``` -------------------------------- ### Display Photo from Camera in WebView Source: https://capawesome.io/plugins/speech-recognition/blog/the-file-handling-guide-for-capacitor This example shows how to pick a photo using the Capacitor Camera plugin and then display it directly in an HTML `` element by using its `webPath` as the source. This method is suitable for images obtained with a `webPath`. ```TypeScript import { Camera, CameraResultType } from '@capacitor/camera'; const displayPhoto = async () => { // 1. Pick a photo const photo = await Camera.getPhoto({ resultType: CameraResultType.Uri }); // 2. Display the photo document.getElementById("savedPhoto").src = photo.webPath; }; ``` ```HTML ``` -------------------------------- ### Capacitor Audio Recorder Plugin Usage Examples Source: https://capawesome.io/plugins/speech-recognition/plugins/audio-recorder Demonstrates how to import and use various functionalities of the Capacitor Audio Recorder plugin, including starting, stopping, pausing, resuming, and canceling recordings, checking and requesting microphone permissions, and listening for recording-related events. ```typescript import { AudioRecorder } from '@capawesome-team/capacitor-audio-recorder'; import { NativeAudio } from '@capacitor-community/native-audio'; const cancelRecording = async () => { await AudioRecorder.cancelRecording(); }; const getRecordingStatus = async () => { const { status } = await AudioRecorder.getRecordingStatus(); console.log('Recording status:', status); }; const pauseRecording = async () => { await AudioRecorder.pauseRecording(); }; const resumeRecording = async () => { await AudioRecorder.resumeRecording(); }; const startRecording = async () => { await AudioRecorder.startRecording(); }; const stopRecording = async () => { // Stop recording and get the audio blob or URI const { blob, uri } = await AudioRecorder.stopRecording(); // Play the audio if (blob) { // Only available on Web const audio = new Audio(); audio.src = URL.createObjectURL(blob); audio.play(); } else if (uri) { // Only available on Android and iOS await NativeAudio.preload({ assetId: 'recording', assetPath: uri, isUrl: true, }); await NativeAudio.play({ assetId: 'recording' }); } }; const checkPermissions = async () => { const { recordAudio } = await AudioRecorder.checkPermissions(); console.log('Record audio permission:', recordAudio); }; const requestPermissions = async () => { const { recordAudio } = await AudioRecorder.requestPermissions(); console.log('Record audio permission:', recordAudio); }; const addRecordingErrorListener = async () => { await AudioRecorder.addListener('recordingError', (event) => { console.error('Recording error:', event.message); }); }; const addRecordingPausedListener = async () => { await AudioRecorder.addListener('recordingPaused', () => { console.log('Recording paused'); }); }; const addRecordingStoppedListener = async () => { await AudioRecorder.addListener('recordingStopped', (event) => { console.log('Recording stopped:', event.uri); }); }; ``` -------------------------------- ### Upload File as Blob using Fetch API Source: https://capawesome.io/plugins/speech-recognition/blog/the-file-handling-guide-for-capacitor This example illustrates how to upload a file by first picking a photo using the Capacitor Camera plugin, loading it as a blob, and then sending it to a server using the standard Fetch API with `FormData`. This method does not require additional plugins for the upload itself. ```TypeScript import { Camera, CameraResultType } from '@capacitor/camera'; import { Capacitor } from '@capacitor/core'; const uploadFile = async (path: string) => { // 1. Pick a photo const photo = await Camera.getPhoto({ resultType: CameraResultType.Uri }); // 2. Load the photo as a blob const response = await fetch(photo.webPath); const blob = response.blob(); // 3. Upload the file const formData = new FormData(); formData.append('file', blob, 'file.jpg'); await fetch('https://example.tld/upload', { method: 'POST', body: formData, }); }; ``` -------------------------------- ### Add Capawesome Registry to .npmrc in AWS Amplify CI/CD Source: https://capawesome.io/plugins/speech-recognition/insiders/getting-started Integrate Capawesome private package access into your AWS Amplify CI/CD pipeline. These commands append the Capawesome registry configuration and authentication token (retrieved from an environment variable) to the `.npmrc` file during the build process. ```Shell - echo "@capawesome-team:registry=https://npm.registry.capawesome.io" >> .npmrc - echo "//npm.registry.capawesome.io/:_authToken=${CAPAWESOME_NPM_REGISTRY_TOKEN}" >> .npmrc ``` -------------------------------- ### Install @capacitor-mlkit/face-detection Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/face-detection This snippet shows the commands to install the @capacitor-mlkit/face-detection plugin using npm and synchronize it with Capacitor projects. ```Shell npm install @capacitor-mlkit/face-detection npx cap sync ``` -------------------------------- ### Install Capacitor Cloudinary Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/cloudinary Installs the @capawesome/capacitor-cloudinary plugin using npm and synchronizes native projects with the Capacitor CLI. ```Shell npm install @capawesome/capacitor-cloudinary npx cap sync ``` -------------------------------- ### Install Google Barcode Scanner Module API Method Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/barcode-scanning Initiates the installation of the Google Barcode Scanner module. The `googleBarcodeScannerModuleInstallProgress` event listener will provide updates on the installation status. This method is only available on Android. ```APIDOC installGoogleBarcodeScannerModule() => Promise ``` -------------------------------- ### Capacitor Speech Synthesis Usage Examples Source: https://capawesome.io/plugins/speech-recognition/plugins/speech-synthesis Demonstrates how to import the plugin and use various methods like activating/deactivating audio sessions, canceling speech, getting languages/voices, checking availability, speaking, synthesizing to file, and adding/removing event listeners. ```typescript import { SpeechSynthesis, AudioSessionCategory, QueueStrategy } from '@capawesome-team/capacitor-speech-synthesis'; const activateAudioSession = async () => { await SpeechSynthesis.activateAudioSession({ category: AudioSessionCategory.Ambient }); }; const cancel = async () => { await SpeechSynthesis.cancel(); }; const deactivateAudioSession = async () => { await SpeechSynthesis.deactivateAudioSession(); }; const getLanguages = async () => { const result = await SpeechSynthesis.getLanguages(); return result.languages; }; const getVoices = async () => { const result = await SpeechSynthesis.getVoices(); return result.voices; }; const initialize = async () => { await SpeechSynthesis.initialize(); }; const isAvailable = async () => { const result = await SpeechSynthesis.isAvailable(); return result.isAvailable; }; const isSpeaking = async () => { const result = await SpeechSynthesis.isSpeaking(); return result.isSpeaking; }; const isLanguageAvailable = async () => { const result = await SpeechSynthesis.isLanguageAvailable({ language: 'en-US' }); return result.isAvailable; }; const isVoiceAvailable = async () => { const result = await SpeechSynthesis.isVoiceAvailable({ voiceId: 'com.apple.ttsbundle.Samantha-compact' }); return result.isAvailable; }; const speak = async () => { // Add an utterance to the utterance queue to be spoken const { utteranceId } = await SpeechSynthesis.speak({ language: 'en-US', pitch: 1.0, queueStrategy: QueueStrategy.Add, rate: 1.0, text: 'Hello, World!', voiceId: 'com.apple.ttsbundle.Samantha-compact', volume: 1.0, }); // Wait for the utterance to finish await new Promise(resolve => { void SpeechSynthesis.addListener('end', event => { if (event.utteranceId === utteranceId) { resolve(); } }); }); }; const synthesizeToFile = async () => { // Add an utterance to the utterance queue to be synthesized to a file const { path, utteranceId } = await SpeechSynthesis.synthesizeToFile({ language: 'en-US', pitch: 1.0, queueStrategy: QueueStrategy.Add, rate: 1.0, text: 'Hello, World!', voiceId: 'com.apple.ttsbundle.Samantha-compact', volume: 1.0, }); // Wait for the utterance to finish await new Promise(resolve => { void SpeechSynthesis.addListener('end', event => { if (event.utteranceId === utteranceId) { resolve(); } }); }); // Return the path to the synthesized audio file return path; }; const addListeners = () => { SpeechSynthesis.addListener('boundary', (event) => { console.log('boundary', event); }); SpeechSynthesis.addListener('end', (event) => { console.log('end', event); }); SpeechSynthesis.addListener('error', (event) => { console.log('error', event); }); SpeechSynthesis.addListener('start', (event) => { console.log('start', event); }); }; const removeAllListeners = async () => { await SpeechSynthesis.removeAllListeners(); }; ``` -------------------------------- ### Capacitor Cloudinary Plugin Usage Examples Source: https://capawesome.io/plugins/speech-recognition/plugins/cloudinary This snippet demonstrates how to initialize the Cloudinary plugin and perform common operations like uploading and downloading resources. It includes examples for setting the cloud name, specifying resource paths, and handling return values for successful operations. ```TypeScript import { Cloudinary, ResourceType } from '@capawesome/capacitor-cloudinary'; const initialize = async () => { await Cloudinary.initialize({ cloudName: 'my_cloud_name' }); }; const uploadResource = async () => { await Cloudinary.uploadResource({ path: 'file:///var/mobile/Containers/Data/Application/22A433FD-D82D-4989-8BE6-9FC49DEA20BB/Images/test.png', publicId: 'my_public_id', resourceType: ResourceType.image, uploadPreset: 'my_preset', }); }; const downloadResource = async () => { const { path } = await Cloudinary.downloadResource({ url: 'https://res.cloudinary.com/myCloudName/image/upload/v123/123.png', }); return path; }; ``` -------------------------------- ### Install Capacitor Android Edge-to-Edge Support Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/android-edge-to-edge-support Installs the `@capawesome/capacitor-android-edge-to-edge-support` plugin and syncs it with Capacitor projects. ```shell npm install @capawesome/capacitor-android-edge-to-edge-support npx cap sync ``` -------------------------------- ### Install @capacitor-mlkit/translation Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/translation Commands to install the @capacitor-mlkit/translation plugin using npm and synchronize the Capacitor project. ```Shell npm install @capacitor-mlkit/translation npx cap sync ``` -------------------------------- ### Install Capawesome CLI Globally Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/advanced/self-hosting Before creating bundles, ensure you have the latest version of the Capawesome CLI installed globally using npm. ```npm npm install -g @capawesome/cli@latest ``` -------------------------------- ### PostHog Plugin: SetupOptions Interface Source: https://capawesome.io/plugins/speech-recognition/plugins/posthog Defines the options for setting up the PostHog SDK. Includes the API key and host of the PostHog instance. ```APIDOC SetupOptions: apiKey: string - The API key of your PostHog project. (Since: 6.0.0) host: string - The host of your PostHog instance. (Default: 'https://us.i.posthog.com') (Since: 6.0.0) ``` -------------------------------- ### Install Capacitor Zip plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/zip Installs the @capawesome-team/capacitor-zip package from the configured npm registry and synchronizes the Capacitor native projects. ```Shell npm install @capawesome-team/capacitor-zip npx cap sync ``` -------------------------------- ### Install Capacitor NFC Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/nfc Commands to install the @capawesome-team/capacitor-nfc plugin via npm and synchronize the native project files with the Capacitor CLI. ```npm npm install @capawesome-team/capacitor-nfc npx cap sync ``` -------------------------------- ### Install Capacitor Audio Recorder Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/audio-recorder Commands to install the Capacitor Audio Recorder plugin package and synchronize it with your Capacitor project, making it available for use. ```shell npm install @capawesome-team/capacitor-audio-recorder npx cap sync ``` -------------------------------- ### Install Capawesome CLI Globally Source: https://capawesome.io/plugins/speech-recognition/blog/announcing-the-capacitor-live-update-plugin Installs the Capawesome Command Line Interface globally to manage apps and bundles from the command line. ```bash npm install -g @capawesome/cli ``` -------------------------------- ### PostHog Plugin: Initialize SDK Source: https://capawesome.io/plugins/speech-recognition/plugins/posthog Initializes the PostHog SDK with the provided configuration options. This method must be called before any other PostHog SDK methods are used. It requires `SetupOptions` including the API key and host. ```APIDOC setup(options: SetupOptions) => Promise options: SetupOptions - The options to set up the PostHog SDK. ``` -------------------------------- ### Configure Capawesome npm Registry for Cloudflare Pages Source: https://capawesome.io/plugins/speech-recognition/insiders/getting-started This snippet shows how to configure the Capawesome private npm registry for projects deployed on Cloudflare Pages. It involves setting an environment variable for the license key and creating an .npmrc file in the project root to point to the private registry and use the token. ```npmrc @capawesome-team:registry=https://npm.registry.capawesome.io //npm.registry.capawesome.io/:_authToken=${CAPAWESOME_NPM_REGISTRY_TOKEN} ``` -------------------------------- ### Initialize Firebase Messaging Service Worker Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor This snippet provides the basic content for the `firebase-messaging-sw.js` file, which initializes the Firebase application and the Firebase Messaging service. It imports necessary Firebase SDK scripts and sets up the configuration for receiving push notifications in the background. ```JavaScript importScripts( "https://www.gstatic.com/firebasejs/9.7.0/firebase-app-compat.js" ); importScripts( "https://www.gstatic.com/firebasejs/9.7.0/firebase-messaging-compat.js" ); firebase.initializeApp({ apiKey: "YOUR_API_KEY", authDomain: "YOUR_AUTH_DOMAIN", projectId: "YOUR_PROJECT_ID", storageBucket: "YOUR_STORAGE_BUCKET", messagingSenderId: "YOUR_MESSAGING_SENDER_ID", appId: "YOUR_APP_ID" }); const messaging = firebase.messaging(); ``` -------------------------------- ### Configure Capawesome npm registry for Capacitor plugin installation Source: https://capawesome.io/plugins/speech-recognition/plugins/file-compressor Sets up the npm configuration to use the Capawesome private registry and authenticates with a license key. This is required to install sponsorware plugins. ```Shell npm config set @capawesome-team:registry https://npm.registry.capawesome.io npm config set //npm.registry.capawesome.io/:_authToken ``` -------------------------------- ### Install Capacitor Secure Preferences Plugin and Sync Project Source: https://capawesome.io/plugins/speech-recognition/plugins/secure-preferences This command installs the @capawesome-team/capacitor-secure-preferences package into your project. Following the installation, 'npx cap sync' integrates the plugin into your native Android and iOS projects, ensuring all dependencies are correctly linked. ```npm npm install @capawesome-team/capacitor-secure-preferences npx cap sync ``` -------------------------------- ### Run Capacitor App on Web, Android, and iOS Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor These shell commands are used to launch a Capacitor application on different platforms. `npx ionic serve` runs the app on the web, while `npx ionic cap run android` and `npx ionic cap run ios` deploy and run the app on Android and iOS devices or emulators, respectively. ```Shell # Run the web platform npx ionic serve # Run the Android platform npx ionic cap run android # Run the iOS platform npx ionic cap run ios ``` -------------------------------- ### Install Capawesome Capacitor Contacts Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/contacts Installs the Capacitor Contacts plugin package from the configured npm registry and synchronizes the native project files with the Capacitor project. ```bash npm install @capawesome-team/capacitor-contacts npx cap sync ``` -------------------------------- ### Open iOS Project with Capacitor CLI for Capability Configuration Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor Use this command to open your iOS project in Xcode via the Capacitor CLI. This is the first step required to enable `Push Notifications` and `Background Modes` capabilities within your Xcode project settings, which are essential for handling push notifications. ```Shell npx cap open ios ``` -------------------------------- ### Install Capacitor Torch Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/torch Install the @capawesome/capacitor-torch plugin using npm and synchronize it with your Capacitor project. ```shell npm install @capawesome/capacitor-torch npx cap sync ``` -------------------------------- ### Install Capacitor ML Kit Face Mesh Detection Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/face-mesh-detection Installs the `@capacitor-mlkit/face-mesh-detection` plugin into your project and synchronizes the Capacitor native platforms. ```Shell npm install @capacitor-mlkit/face-mesh-detection npx cap sync ``` -------------------------------- ### Examples of Binary Compatible and Non-Compatible Changes Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/faq Lists examples of changes to a mobile application's web layer that are considered binary compatible, and changes to native code that are not, impacting the need for app store resubmission. ```APIDOC Examples of binary compatible changes: * Changes to your HTML, CSS, or JavaScript * Changes to your assets (images, fonts, etc.) Examples of changes that are NOT binary compatible: * Changes to native code (Java, Swift, Objective-C) * Changes to native dependencies (CocoaPods, Gradle, etc.) ``` -------------------------------- ### Install Capacitor Speech Recognition Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/speech-recognition Installs the `@capawesome-team/capacitor-speech-recognition` package and synchronizes Capacitor native projects for Android and iOS. ```Shell npm install @capawesome-team/capacitor-speech-recognition npx cap sync ``` -------------------------------- ### Install Capacitor ML Kit Barcode Scanning Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/barcode-scanning This snippet shows the npm commands to install the Capacitor ML Kit Barcode Scanning plugin and synchronize it with your Capacitor project. ```npm npm install @capacitor-mlkit/barcode-scanning npx cap sync ``` -------------------------------- ### Install Capacitor Firebase Firestore Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/firebase/cloud-firestore Installs the Capacitor Firebase Firestore plugin using npm and synchronizes Capacitor native projects. Requires prior Firebase project setup for Android, iOS, and Web. ```Shell npm install @capacitor-firebase/firestore npx cap sync ``` -------------------------------- ### Install Ionic CLI Globally Source: https://capawesome.io/plugins/speech-recognition/blog/how-to-build-a-heart-rate-monitor-with-capacitor Installs the Ionic Command Line Interface globally, allowing access to Ionic project creation and management commands from any directory. ```shell npm install -g @ionic/cli ``` -------------------------------- ### Capacitor Speech Recognition Plugin Usage Examples Source: https://capawesome.io/plugins/speech-recognition/plugins/speech-recognition This snippet demonstrates various ways to use the Capacitor Speech Recognition plugin, including starting and stopping speech recognition, checking and requesting necessary permissions, verifying availability and listening status, retrieving supported languages, and adding/removing event listeners for different recognition states. ```TypeScript import { SpeechRecognition } from '@capawesome-team/capacitor-speech-recognition'; const startListening = async () => { await SpeechRecognition.startListening({ language: 'en-US', silenceThreshold: 2000, }); }; const stopListening = async () => { await SpeechRecognition.stopListening(); }; const checkPermissions = async () => { const { audioRecording, speechRecognition } = await SpeechRecognition.checkPermissions(); }; const requestPermissions = async () => { const { audioRecording, speechRecognition } = await SpeechRecognition.requestPermissions({ permissions: ['audioRecording', 'speechRecognition'], }); }; const isAvailable = async () => { const { available } = await SpeechRecognition.isAvailable(); return available; }; const isListening = async () => { const { listening } = await SpeechRecognition.isListening(); return listening; }; const getSupportedLanguages = async () => { const { languages } = await SpeechRecognition.getSupportedLanguages(); return languages; }; const addListeners = () => { SpeechRecognition.addListener('start', () => { console.log('Speech recognition started'); }); SpeechRecognition.addListener('end', () => { console.log('Speech recognition ended'); }); SpeechRecognition.addListener('error', (event) => { console.error('Speech recognition error:', event.message); }); SpeechRecognition.addListener('partialResult', (event) => { console.log('Partial result:', event.result); }); SpeechRecognition.addListener('result', (event) => { console.log('Final result:', event.result); }); SpeechRecognition.addListener('speechStart', () => { console.log('User started speaking'); }); SpeechRecognition.addListener('speechEnd', () => { console.log('User stopped speaking'); }); }; const removeAllListeners = async () => { await SpeechRecognition.removeAllListeners(); }; ``` -------------------------------- ### Capacitor Badge Plugin Usage Examples Source: https://capawesome.io/plugins/speech-recognition/plugins/badge This snippet provides various examples of how to use the Capacitor Badge plugin's API. It includes functions for getting, setting, increasing, decreasing, and clearing the badge count, as well as checking support and managing permissions. ```TypeScript import { Badge } from '@capawesome/capacitor-badge'; const get = async () => { const result = await Badge.get(); return result.count; }; const set = async (count: number) => { await Badge.set({ count }); }; const increase = async () => { await Badge.increase(); }; const decrease = async () => { await Badge.decrease(); }; const clear = async () => { await Badge.clear(); }; const isSupported = async () => { const result = await Badge.isSupported(); return result.isSupported; }; const checkPermissions = async () => { const result = await Badge.checkPermissions(); }; const requestPermissions = async () => { const result = await Badge.requestPermissions(); }; ``` -------------------------------- ### Install Capawesome Capacitor Printer Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/printer Installs the Capacitor Printer plugin package via npm and synchronizes the native project files. This step is required after configuring the Capawesome npm registry. ```npm npm install @capawesome-team/capacitor-printer npx cap sync ``` -------------------------------- ### Enable/Disable Firebase Performance Monitoring Source: https://capawesome.io/plugins/speech-recognition/plugins/firebase/performance-monitoring Provides an example of how to enable or disable Firebase Performance Monitoring for the application. Changes apply on the next app start. ```TypeScript import { FirebasePerformance } from '@capacitor-firebase/performance'; const setEnabled = async () => { await FirebasePerformance.setEnabled({ enabled: true }); }; ``` -------------------------------- ### Install Capacitor Live Update Plugin Source: https://capawesome.io/plugins/speech-recognition/blog/announcing-the-capacitor-live-update-plugin Install the @capawesome/capacitor-live-update package and synchronize your Capacitor project to enable live updates. This step is essential before utilizing the plugin's features. ```shell npm install @capawesome/capacitor-live-update npx cap sync ``` -------------------------------- ### Capacitor MLKit Translation Plugin Usage Examples Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/translation Demonstrates how to use the Capacitor MLKit Translation plugin to manage language models (download, delete, get downloaded) and translate text between languages. ```TypeScript import { Translation, Language } from '@capacitor-mlkit/translation'; const deleteDownloadedModel = async () => { await Translation.deleteDownloadedModel({ language: Language.English, }); }; const downloadModel = async () => { await Translation.downloadModel({ language: Language.English, }); }; const getDownloadedModels = async () => { const { languages } = await Translation.getDownloadedModels(); return languages; }; const translate = async () => { const { text } = await Translation.translate({ text: 'Good morning!', sourceLanguage: Language.English, targetLanguage: Language.German, }); return text; }; ``` -------------------------------- ### Install Capacitor ML Kit Subject Segmentation Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/subject-segmentation Installs the `@capacitor-mlkit/subject-segmentation` plugin and synchronizes it with your Capacitor project, making it available for use in your application. ```shell npm install @capacitor-mlkit/subject-segmentation npx cap sync ``` -------------------------------- ### Install Capacitor Speech Synthesis plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/speech-synthesis Installs the @capawesome-team/capacitor-speech-synthesis package via npm and then synchronizes the native project files with the Capacitor plugin. ```Shell npm install @capawesome-team/capacitor-speech-synthesis npx cap sync ``` -------------------------------- ### Run Node.js Script to Send Notification Source: https://capawesome.io/plugins/speech-recognition/blog/the-push-notifications-guide-for-capacitor Executes the `main.js` script using Node.js, which will trigger the Firebase Admin SDK to send the configured push notification. ```Shell node main.js ``` -------------------------------- ### Install @capacitor-firebase/app and Firebase Source: https://capawesome.io/plugins/speech-recognition/plugins/firebase/app Installs the @capacitor-firebase/app plugin and the core Firebase JavaScript SDK using npm, then synchronizes native projects with Capacitor. ```Shell npm install @capacitor-firebase/app firebase npx cap sync ``` -------------------------------- ### Install Web Barcode Detector Polyfill Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/barcode-scanning This snippet shows the npm command to install the `barcode-detector` package, which provides a polyfill for the Barcode Detection API, improving compatibility across web browsers. ```npm npm install barcode-detector ``` -------------------------------- ### Use Capacitor App Review Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/app-review Examples demonstrating how to import and use the `openAppStore` and `requestReview` methods from the `@capawesome/capacitor-app-review` plugin. ```TypeScript import { AppReview } from '@capawesome/capacitor-app-review'; const openAppStore = async () => { await AppReview.openAppStore(); }; const requestReview = async () => { await AppReview.requestReview(); }; ``` -------------------------------- ### Install Capacitor Firebase Performance Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/firebase/performance-monitoring Installs the Capacitor Firebase Performance plugin and Firebase SDK using npm, followed by syncing Capacitor native projects. ```Shell npm install @capacitor-firebase/performance firebase npx cap sync ``` -------------------------------- ### Configure npm registry for Capawesome Insiders Source: https://capawesome.io/plugins/speech-recognition/plugins/wifi Sets up the Capawesome npm registry and authenticates with your license key to enable plugin installation. ```npm npm config set @capawesome-team:registry https://npm.registry.capawesome.io npm config set //npm.registry.capawesome.io/:_authToken ``` -------------------------------- ### Create Self-Hosted Bundle with Capawesome CLI Source: https://capawesome.io/plugins/speech-recognition/cloud/live-updates/advanced/self-hosting Use the `apps:bundles:create` command to create a new self-hosted bundle, providing the URL where your bundle is hosted. The bundle will be immediately available to users. ```cli npx @capawesome/cli apps:bundles:create --url https://domain.tld/bundle.zip ``` -------------------------------- ### Install Capacitor Datetime Picker Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/datetime-picker This snippet provides the necessary commands to install the Capacitor Datetime Picker plugin using npm and synchronize it with your Capacitor project. It ensures the plugin's native dependencies are linked correctly for both Android and iOS. ```shell npm install @capawesome-team/capacitor-datetime-picker npx cap sync ``` -------------------------------- ### Install Capacitor ML Kit Selfie Segmentation Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/mlkit/selfie-segmentation This snippet demonstrates how to install the @capacitor-mlkit/selfie-segmentation plugin using npm and synchronize it with your Capacitor project. This is the first step to integrate the plugin into your application. ```Shell npm install @capacitor-mlkit/selfie-segmentation npx cap sync ``` -------------------------------- ### API: Start Speech Recognition Listening Source: https://capawesome.io/plugins/speech-recognition/plugins/speech-recognition Initiates the speech recognition process, allowing the device to start listening for user speech. Optional parameters can be provided to configure the listening behavior, such as language and silence threshold. ```APIDOC startListening(options?: StartListeningOptions | undefined) => Promise Description: Start listening for speech. Parameters: options: StartListeningOptions Since: 6.0.0 ``` -------------------------------- ### Install Capacitor Badge Plugin Source: https://capawesome.io/plugins/speech-recognition/plugins/badge Installs the Capacitor Badge plugin using npm and synchronizes it with native platforms (Android and iOS). This is the initial step to integrate the plugin into your Capacitor project. ```Shell npm install @capawesome/capacitor-badge npx cap sync ```