### Example Plugin Installation with Plugman Source: https://developer.amazon.com/docs/fire-tv/cordova-plugin-catalog.html An example demonstrating how to install the Cordova Amazon Catalog plugin using plugman with specific parameter values. This shows concrete settings for DISPLAY_NAME, PARTNER_ID, and DEFAULT_SIGNEDIN_STATUS. ```bash plugman install --platform android --project ./platforms/android --plugin ../../CI-Plugin-For-Release --variable DISPLAY_NAME="ACME" --variable PARTNER_ID="ACME" --variable DEFAULT_SIGNEDIN_STATUS="TRUE" ; ``` -------------------------------- ### Example JDK Version Output Source: https://developer.amazon.com/docs/fire-tv/setting-up-your-development-environment.html This is an example of the output you should see if the JDK is installed and configured correctly. ```text java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.101-b13, mixed mode) ``` -------------------------------- ### Example Release VPKG File Path Source: https://developer.amazon.com/docs/vega/0.22/app-submission.html An example of a release VPKG file path for a specific project setup. ```bash ~/workspaces/hellovega/build/armv7-release/hellovega_armv7.vpkg ``` -------------------------------- ### Basic Stack Navigator Setup Source: https://developer.amazon.com/docs/vega-api/0.22/react-navigation-7-0-0.html This example shows a basic setup for a stack navigator with multiple screens, including navigation logic and styling. ```typescript import {enableFreeze, enableScreens} from '@amazon-devices/react-native-screens'; import {NavigationContainer} from '@amazon-devices/react-navigation__native'; import {createStackNavigator} from '@amazon-devices/react-navigation__stack'; import * as React from 'react'; import {StyleSheet, Text, TouchableOpacity, View} from 'react-native'; function generateRandomColors(n: number): string[] { const generatedColors: string[] = []; for (let i = 0; i < n; i++) { const red = Math.floor(Math.random() * 128 + 64); const green = Math.floor(Math.random() * 128 + 64); const blue = Math.floor(Math.random() * 128 + 64); const hex = `#${red.toString(16).padStart(2, '0')}${green .toString(16) .padStart(2, '0')}${blue.toString(16).padStart(2, '0')}`; generatedColors.push(hex); } return generatedColors; } enableScreens(); enableFreeze(); const Stack = createStackNavigator(); const styles = StyleSheet.create({ screenContainer: { flex: 1, alignItems: 'center', justifyContent: 'center', }, text: { fontSize: 30, }, button: { width: 200, height: 100, alignItems: 'center', justifyContent: 'center', }, buttonContainer: { flexWrap: 'wrap', }, }); const numberOfScreens = 4; const colors = generateRandomColors(numberOfScreens); const Screen = ({navigation, route}: {navigation: any; route: any}) => { const {id} = route.params; return ( SCREEN {id} {colors.map((color, buttonId) => ( navigation.navigate('Screen' + buttonId)}> Go to screen #{buttonId} ))} navigation.goBack()}> {'<- Go back'} ); }; const screenOptions = {animationEnabled: true}; export const App = () => ( {colors.map((_, id) => ( ))} ); ``` -------------------------------- ### Sample Data for Device Setup Connections Source: https://developer.amazon.com/docs/amazon-data-portability/available-scopes.html Provides an example of data conforming to the Device Setup Connections schema. This data represents a single frustration-free setup session for a Kindle device. ```json [ { "provisionerDeviceType": "KINDLE", "provisionerDeviceModel": "AFTEU011", "provisionerFirmwareVersion": "15.5", "endTime": "2017-05-06 22:06:04.0", "provisioneeZigbeeMacAddress": "00:17:88:01:XX:XX:XX:XX", "provisioneeWifiMacAddress": null, "eventDate": "2017-05-06 22:06:04.0", "chosenSsidCredentialsChanged": "Yes", "provisioneeDeviceName": "Echo Dot-W0J", "provisioneeDeviceModel": "A3VRME03NAXFUB", "deviceSerialNumber": "xxxLF1071771JPX", "provisioneeHardwareVersion": "mt8169", "provisioneeFriendlyName": null, "provisioneeFirmwareVersion": "7.1.2", "provisioneeBLEMacAddress": "C3:A4:D2:D8:DD:DA" } ] ``` -------------------------------- ### Sample Device Setup Connections Data Source: https://developer.amazon.com/docs/amazon-data-portability/available-scopes.html Provides an example of data conforming to the Device Setup Connections schema. This sample illustrates the expected format and values for a single device setup session. ```json [ { "provisionerDeviceType": "ECHO", "provisionerDeviceModel": "AFTEU011", "provisionerFirmwareVersion": "15.5", "endTime": "2017-05-06 22:06:04.0", "provisioneeZigbeeMacAddress": "00:17:88:01:XX:XX:XX:XX", "provisioneeWifiMacAddress": null, "eventDate": "2017-05-06 22:06:04.0", "chosenSsidCredentialsChanged": "Yes", "provisioneeDeviceName": "Echo Dot-W0J", "provisioneeDeviceModel": "A3VRME03NAXFUB", "deviceSerialNumber": "xxxLF1071771JPX", "provisioneeHardwareVersion": "mt8169", "provisioneeFriendlyName": null, "provisioneeFirmwareVersion": "7.1.2", "provisioneeBLEMacAddress": "C3:A4:D2:D8:DD:DA" } ] ``` -------------------------------- ### GET Request Example Source: https://developer.amazon.com/docs/amazon-data-portability/portability-uri.html Example of a GET request to retrieve records for a data query. ```APIDOC ## GET /portability-physical-orders/data-queries/{queryId}/records ### Description Retrieves records associated with a specific data query. ### Method GET ### Endpoint `https://intake.eu-west-1.portability.data.amazon/portability-physical-orders/data-queries/{queryId}/records` ### Parameters #### Path Parameters - **queryId** (string) - Required - The ID of the data query. ### Request Example ```curl curl --request GET 'https://intake.eu-west-1.portability.data.amazon/portability-physical-orders/data-queries/a1111111-b222-c333-d444-e55555555555/records' \ -H 'authorization: Bearer $ACCESS_TOKEN' \ -l ``` ``` -------------------------------- ### Main Application Entry Point (app_main) Source: https://developer.amazon.com/docs/frustration-free-setup/wss-over-wifi-on-amazon-freertos.html This function initializes the ESP board and FreeRTOS system, then creates a task for Frustration-Free Setup. It waits for the provisioning result and logs the outcome. ```c int app_main( void ) { // Initialize ESP board and FreeRTOS system. ... // Run runFrustrationFreeSetup **xTaskCreate****(runFrustrationFreeSetup, "FrustrationFreeSetup", FFS_TASK_STACK_SIZE, NULL, tskIDLE_PRIORITY, &ffsTaskHandle); ** // Process the result of runFrustrationFreeSetup xEventGroupWaitBits(ffsProvisioningResultEventGroup, FFS_PROVISIONING_RESULT_BIT, pdTRUE, pdFALSE, portMAX_DELAY); xSemaphoreTake(ffsProvisioningResultSemaphore, portMAX_DELAY); FFS_PROVISIONING_RESULT result = ffsProvisioningResult; xSemaphoreGive(ffsProvisioningResultSemaphore); vEventGroupDelete(ffsProvisioningResultEventGroup); vSemaphoreDelete(ffsProvisioningResultSemaphore); if (result == FFS_PROVISIONING_RESULT_PROVISIONED) { ffsLogInfo("Provisioning was successful."); } else { ffsLogInfo("Provisioning was not successful."); // Here, you should add a manual method to provision the device. } return 0; } ``` -------------------------------- ### setupContentLauncherServer Source: https://developer.amazon.com/docs/vega-api/0.22/turbo-modules.KeplerScriptContentLauncher.interfaces.KeplerScriptContentLauncher.amazon-devices_kepler-media-content-launcher.html Sets up the native ContentLauncherServer. ```APIDOC ## setupContentLauncherServer() ### Description Setup the native ContentLauncherServer. ### Method `setupContentLauncherServer` ### Returns `Promise` ``` -------------------------------- ### Get Report Schedule by ID in Node.js Source: https://developer.amazon.com/docs/amazon-pay-api-v2/reports.html This Node.js example demonstrates initializing the Amazon Pay API SDK and retrieving a report schedule. It uses Promises to handle the asynchronous response and requires the SDK to be installed. ```Node.js const fs = require('fs'); const Client = require('@amazonpay/amazon-pay-api-sdk-nodejs'); const config = { publicKeyId: 'YOUR_PUBLIC_KEY_ID', privateKey: fs.readFileSync('tst/private.pem'), region: 'YOUR_REGION_CODE', algorithm: 'AMZN-PAY-RSASSA-PSS-V2' }; const reportScheduleId = '68973459224'; const testPayClient = new Client.WebStoreClient(config); const response = testPayClient.getReportScheduleById(reportScheduleId); response.then(function (result) { console.log(result.data); }).catch(err => { console.log(err); }); ``` -------------------------------- ### Systrace Example Output Markers (Warm Start) Source: https://developer.amazon.com/docs/app-testing/app-performance-scripts.html Shows example Systrace output markers for a warm start scenario. Similar to cold starts, the time difference between the start and end markers indicates the event duration. ```text Start Marker: Binder:525_7-1078 ( 525) [000] ...1 3452.891078: tracing_mark_write: B|525|AMS.startActivityAsUser End Marker: RenderThread-15305 (15260) [000] ...1 3453.695058: tracing_mark_write: B|15260|eglSwapBuffersWithDamageKHR (of the Respective app PID) Value: Time Difference Between the End Maker and Start Marker ``` -------------------------------- ### Get Library Albums Response Example Source: https://developer.amazon.com/docs/music/API_web_albums.html Example JSON response structure for the get library albums endpoint, showing album details and pagination information. ```json { "data": { "user": { "id": "6ozjgidgbvjdv3j6dd5jm7ipom", "libraryAlbums": { "pageInfo": { "hasNextPage": false }, "edgeCount": 2, "edges": [ { "purchased": false, "uploaded": false, "node": { "id": "B07B62ZK5S" }, "objectId": "15e6a15f-4c2f-4b24-a2fd-286b37ad4fa3" }, { "purchased": false, "uploaded": false, "node": { "id": "B06VWVWDDH" }, "objectId": "15e6a15f-4c2f-4b24-a2fd-286b37ad4fa3" }, ... ] } } } } ``` -------------------------------- ### Installation Source: https://developer.amazon.com/docs/react-native-vega/0.72/asyncstorage.html Instructions on how to import and use the legacy AsyncStorage library. ```APIDOC ## Installation Importing the legacy version of the `AsyncStorage` library: ```javascript import AsyncStorage from '@amazon-devices/react-native-kepler'; ``` **Note** : `AsyncStorage` was recently removed from the mainline React Native libraries. We are working on creating a path to use AsyncStorage more idiomatically. Until this is completed, include `AsyncStorage` in place of the import as follows: ```javascript const AsyncStorage = require("@amazon-devices/react-native-kepler/Libraries/Storage/AsyncStorage"); ``` Be aware that this imports `AsyncStorage` as type `any`, thus any related code will have relaxed type checking. Persisting data: ```javascript _storeData = async () => { try { await AsyncStorage.setItem( '@MySuperStore:key', 'I like to save it.', ); } catch (error) { // Error saving data } }; ``` Fetching data: ```javascript _retrieveData = async () => { try { const value = await AsyncStorage.getItem('TASKS'); if (value !== null) { // We have data!! console.log(value); } } catch (error) { // Error retrieving data } }; ``` ``` -------------------------------- ### Get Installer Package Name Source: https://developer.amazon.com/docs/vega-api/0.22/react-native-device-info.html Retrieves the package name of the installer that installed the application. This method returns a promise that resolves with the installer's package name. ```javascript DeviceInfo.getInstallerPackageName().then((installerPackageName) => { // "com.amazon.venezia" }); ``` -------------------------------- ### Pre-Launch Setup API Calls Source: https://developer.amazon.com/docs/physicalstores/sample_store_combo.html Initiate and monitor catalog uploads before store launch. This involves uploading the product catalog and checking its status. ```bash POST /v1/catalog/upload ``` ```bash POST /v1/catalog/getCatalogUploadStatus ``` -------------------------------- ### setupChannelServer Source: https://developer.amazon.com/docs/vega-api/0.22/turbo-modules.KeplerScriptChannel.interfaces.KeplerScriptChannel.amazon-devices_kepler-channel.html Initializes the native ChannelServer. ```APIDOC ## setupChannelServer() ### Description Setup the native ChannelServer. ### Method `setupChannelServer` ### Returns `Promise` - A promise that resolves when the ChannelServer is set up. ``` -------------------------------- ### Get Markets API Response Example Source: https://developer.amazon.com/docs/music/API_web_market.html This is an example of the JSON response you can expect when successfully calling the Get Markets API. It contains a list of supported Amazon Music markets, each with an ID and name. ```json { "data": { "markets": [ { "id": "AR", "name": "Argentina" }, { "id": "BE", "name": "Belgium" }, { "id": "BG", "name": "Bulgaria" } ] } } ``` -------------------------------- ### Run Setup Script Source: https://developer.amazon.com/docs/vega/0.22/media-player-dash-player.html Execute the setup.sh script from the /dash-rel/scripts directory to build the Dash.js player. This script automates manual integration steps. ```bash ./setup.sh ``` -------------------------------- ### Successful Installation Confirmation Source: https://developer.amazon.com/docs/fire-tv/installing-and-running-your-app.html This is an example of the success message returned by ADB after a successful app installation. ```text 764 KB/s (217246 bytes in 0.277s) pkg: /data/local/tmp/HelloWorld.apk Success ``` -------------------------------- ### Initialize and Use WebstoreClient in Java Source: https://developer.amazon.com/docs/amazon-pay-api-v2/reports.html Demonstrates initializing the PayConfiguration and WebstoreClient, then retrieving a report by its ID. Includes basic error handling. ```java import com.amazon.pay.api.AmazonPayResponse; import com.amazon.pay.api.PayConfiguration; import com.amazon.pay.api.WebstoreClient; import com.amazon.pay.api.exceptions.AmazonPayClientException; import com.amazon.pay.api.types.Environment; import com.amazon.pay.api.types.Region; public void sample() { PayConfiguration payConfiguration = null; try { payConfiguration = new PayConfiguration() .setPublicKeyId("YOUR_PUBLIC_KEY_ID") .setRegion(Region.YOUR_REGION_CODE) .setPrivateKey("YOUR_PRIVATE_KEY") .setEnvironment(Environment.LIVE) .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2"); WebstoreClient webstoreClient = new WebstoreClient(payConfiguration); AmazonPayResponse response = null; String reportId = "A08439021T39K6DTX4JS8"; response = webstoreClient.getReportById(reportId); } catch (AmazonPayClientException e) { e.printStackTrace(); } } ``` -------------------------------- ### Java GetReports API Example Source: https://developer.amazon.com/docs/amazon-pay-reports/downloading-reports.html This example shows how to use the WebstoreClient to get reports in Java. ```APIDOC ## GetReports API ### Description Initiates a request to retrieve reports using the WebstoreClient. This method is part of the Amazon Pay API for accessing financial and operational data. ### Method `getReports()` ### Parameters This method does not require explicit parameters in the call itself, but the `WebstoreClient` must be initialized with valid `PayConfiguration`. ### Request Example ```java PayConfiguration payConfiguration = null; try { payConfiguration = new PayConfiguration() .setPublicKeyId("YOUR_PUBLIC_KEY_ID") .setRegion(Region.YOUR_REGION_CODE) .setPrivateKey("YOUR_PRIVATE_KEY") .setEnvironment(Environment.LIVE) .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2"); WebstoreClient webstoreClient = new WebstoreClient(payConfiguration); AmazonPayResponse response = null; response = webstoreClient.getReports(); } catch (AmazonPayClientException e) { e.printStackTrace(); } ``` ### Response #### Success Response - `response` (AmazonPayResponse) - An object containing the API response, which includes report data if the request was successful. #### Error Handling - `AmazonPayClientException` - Catches potential errors during the API call or client initialization. ``` -------------------------------- ### Get First Install Time Source: https://developer.amazon.com/docs/vega-api/0.22/react-native-device-info.html Retrieves the time in milliseconds when the application was first installed on the device. This method returns a promise that resolves with the installation timestamp. ```javascript DeviceInfo.getFirstInstallTime().then((firstInstallTime) => { // 1517681764528 }); ``` -------------------------------- ### Verify npm installation Source: https://developer.amazon.com/docs/vega/0.22/monorepo-issues.html Check if npm is installed by running the `npm -v` command. This is a step to resolve npm installation failures during monorepo setup. ```bash npm -v ``` -------------------------------- ### Example Java Version Output Source: https://developer.amazon.com/docs/fire-app-builder/download-and-build.html This is an example of the output you should see when checking the Java version if the JDK is installed. ```text java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode ``` -------------------------------- ### Initialize WebstoreClient and Get Charge (Java) Source: https://developer.amazon.com/docs/amazon-pay-api-v2/charge.html Shows how to initialize the PayConfiguration and WebstoreClient in Java, then retrieve charge details. Includes exception handling for potential client errors. ```java PayConfiguration payConfiguration = null; try { payConfiguration = new PayConfiguration() .setPublicKeyId("YOUR_PUBLIC_KEY_ID") .setRegion(Region.YOUR_REGION_CODE) .setPrivateKey("YOUR_PRIVATE_KEY".toCharArray()) .setEnvironment(Environment.SANDBOX) .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2"); WebstoreClient webstoreClient = new WebstoreClient(payConfiguration); AmazonPayResponse response = webstoreClient.getCharge('S01-5105180-3221187-C056351'); } catch (AmazonPayClientException e) { e.printStackTrace(); } ``` -------------------------------- ### Successful APK Installation Message Source: https://developer.amazon.com/docs/fire-tablets/webapp-use-debug-apk.html Example output indicating that the debug APK has been successfully installed on the device. ```text 588 KB/s (24742963 bytes in 41.073s) pkg: /data/local/tmp/MyAPK.apk Success ``` -------------------------------- ### Example: Backup Specific Application Source: https://developer.amazon.com/docs/fire-tablets/fire-os-8.html This is an example of how to run a full backup for a specific application package. ```bash adb shell bmgr backupnow com.example.app ``` -------------------------------- ### Device Cold Start Vital Logs Example Source: https://developer.amazon.com/docs/app-testing/app-performance-scripts-fire-tablet.html This snippet shows an example of device cold start vital logs, including performance metrics like cool app launch time and user app launch counters. ```Log 03-03 12:42:32.589 892 992 I Vlog : PhoneWindowManager:ScreenTime:fgtracking=false;DV;1,Timer=1.0;TI;1,unit=count;DV;1,metadata=!{"d"#{"groupId"#""$"schemaId"#"123"$"startTimeMs"#"1.677827544773E12"$"packageName"#""$"endTimeMs"#"1.677827552587E12"$"durationMs"#"7813.0"}};DV;1:HI 03-03 12:42:33.657 892 1092 I Vlog : performance:cool_app_launch_time:fgtracking=false;DV;1,key=;DV;1,**Timer****=****1333.0**;TI;1,unit=ms;DV;1,metadata=App_Metadata!{"d"#{"groupId"#"abc"$"schemaId"#"abc"$"app_version"#"123"$"isChild"#"false"}$"m"#{"prev"#""$"context"#"abc"}};DV;1:HI 03-03 12:42:33.661 892 1092 I Vlog : performance:user_app_launch_cool:fgtracking=false;DV;1,key=;DV;1,Counter=1;CT;1,unit=count;DV;1,metadata=App_Metadata!{"d"#{"groupId"#"abc"$"schemaId"#"abc"$"isChild"#"false"}};DV;1:HI 03-03 12:49:20.880 892 1092 I Vlog : performance:cool_app_launch_time:fgtracking=false;DV;1,key=;DV;1,**Timer****=****1225.0**;TI;1,unit=ms;DV;1,metadata=App_Metadata!{"d"#{"groupId"#"abc"$"schemaId"#"abc"$"app_version"#"123"$"isChild"#"false"}$"m"#{"prev"#""$"context"#"abc"}};DV;1:HI 03-03 12:49:20.918 892 1092 I Vlog : performance:user_app_launch_cool:fgtracking=false;DV;1,key=;DV;1,Counter=1;CT;1,unit=count;DV;1,metadata=App_Metadata!{"d"#{"groupId"#"abc"$"schemaId"#"abc"$"isChild"#"false"}};DV;1:HI ``` -------------------------------- ### Build the Reference Video Skill Project Source: https://developer.amazon.com/docs/video-skills-multimodal-devices/sample-video-skill-install.html Run this command in your project's infrastructure folder to install dependencies, clean the project, run unit tests, and compile the code. The output is placed in the ./dist folder. ```bash npm run release ``` -------------------------------- ### Initialize WebstoreClient and Get Charge Permission (Java) Source: https://developer.amazon.com/docs/amazon-pay-api-v2/charge-permission.html Shows how to configure and initialize the WebstoreClient in Java, then retrieve a charge permission by its ID. Includes exception handling for potential client errors. ```java import com.amazon.pay.api.AmazonPayResponse; import com.amazon.pay.api.PayConfiguration; import com.amazon.pay.api.WebstoreClient; import com.amazon.pay.api.exceptions.AmazonPayClientException; import com.amazon.pay.api.types.Environment; import com.amazon.pay.api.types.Region; public void sample() { PayConfiguration payConfiguration = null; try { payConfiguration = new PayConfiguration() .setPublicKeyId("YOUR_PUBLIC_KEY_ID") .setRegion(Region.YOUR_REGION_CODE) .setPrivateKey("YOUR_PRIVATE_KEY".toCharArray()) .setEnvironment(Environment.SANDBOX) .setAlgorithm("AMZN-PAY-RSASSA-PSS-V2"); WebstoreClient webstoreClient = new WebstoreClient(payConfiguration); AmazonPayResponse response = webstoreClient.getChargePermission('S01-5105180-3221187'); } catch (AmazonPayClientException e) { e.printStackTrace(); } } ``` -------------------------------- ### Start Appium Server Source: https://developer.amazon.com/docs/vega/0.22/appium-setup.html Run this command in your terminal to start the Appium server. Ensure Appium is installed and accessible in your PATH. ```bash appium ``` -------------------------------- ### Install and Build App Source: https://developer.amazon.com/docs/vega/0.22/media-player-shaka-player.html Commands to install dependencies and build the application. ```bash npm install npm run build:app ``` -------------------------------- ### Node.js SDK - Get Refund Example Source: https://developer.amazon.com/docs/amazon-pay-api-v2/refund.html Example of using the Amazon Pay Node.js SDK to retrieve refund information. ```APIDOC ## Node.js SDK - Get Refund Example ### Description This Node.js code demonstrates how to initialize the Amazon Pay WebStoreClient and call the `getRefund` method to retrieve refund details. ### Method `testPayClient.getRefund(refundId)` ### Parameters #### Path Parameters - **refundId** (string) - Required - The unique identifier of the refund. ### Request Example ```javascript const config = { publicKeyId: 'YOUR_PUBLIC_KEY_ID', privateKey: fs.readFileSync('tst/private.pem'), region: 'YOUR_REGION_CODE', sandbox: true, algorithm: 'AMZN-PAY-RSASSA-PSS-V2' }; const testPayClient = new Client.WebStoreClient(config); const response = testPayClient.getRefund('S01-5105180-3221187-R022311'); ``` ```