### Install and Start Application using WAP Provisioning Source: https://techdocs.zebra.com/emdk-for-android/14-0/mx/appgallerymgr This snippet illustrates installing an application and then starting it using WAP provisioning. It first uses the AppMgr characteristic to install the APK and then the Intent characteristic to start the main activity of the installed application. ```xml ``` -------------------------------- ### Personal Shopper - Introduction and Setup Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/personalshopper Provides an introduction to the EMDK for Android's Personal Shopper feature and demonstrates how to get access to the EMDKManager and create an instance of the PersonalShopper class. ```APIDOC ## Introduction to Personal Shopper The EMDK for Android provides developers with tools to create Personal Shopper applications for the MC18 device. This feature type is specific to the MC18 personal shopper Android KK device and supports smart cradle and diagnostic interfaces. ### Getting EMDKManager Instance ```java EMDKManager emdkManager = EMDKManager.getEMDKManager(getApplicationContext(), this); ``` ### Creating PersonalShopper Instance ```java PersonalShopper personalShopper = (PersonalShopper) this.emdkManager.getInstance(FEATURE_TYPE.PERSONALSHOPPER); if (personalShopper == null) { // This feature is not supported on the device in use. } ``` ``` -------------------------------- ### Install Application via APK Source: https://techdocs.zebra.com/emdk-for-android/14-0/mx/appgallerymgr Silently installs an application from a specified APK file path. The example shows installation of Clock.apk from the /enterprise/usr/persist folder. ```xml ``` -------------------------------- ### Output XML for "Install Apps from Unknown Sources" Status Source: https://techdocs.zebra.com/emdk-for-android/14-0/mx/devadmin This is an example output XML showing the status of the 'Install Apps from Unknown Sources' setting. A value of '1' typically indicates it is enabled. Note: Queries are not supported on Android 11 or later. ```xml ``` -------------------------------- ### Query XML to Get Status of "Install Apps from Unknown Sources" Source: https://techdocs.zebra.com/emdk-for-android/14-0/mx/devadmin This XML query retrieves the current status of the 'Install Apps from Unknown Sources' setting. Note: Queries are not supported on Android 11 or later. ```xml ``` -------------------------------- ### Compiling with Latest Gradle (v7.0+) Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/setup Configuration for the latest Gradle versions (v7.0 and later) to compile EMDK for Android. It uses mavenCentral and specifies updated dependency versions. ```gradle repositories { google() mavenCentral() /* <- formerly "jcenter()" } dependencies { classpath "com.android.tools.build:gradle:7.0.3" } dependencies { compileOnly 'com.symbol:emdk:9.1.1' } ``` -------------------------------- ### Profile Manager - Apply Device Profiles (Java) Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/programming-guides This guide provides an overview of using the Profile Manager to get instances, apply profile XMLs, interpret results, and understand response XML schemas. It enables developers to configure device settings based on application requirements. ```Java /* * This is a placeholder for a Java code example demonstrating the use of the Profile Manager API. * Actual implementation involves loading and applying a profile XML to the device. */ // Example snippet (conceptual): // EMDKManager emdkManager = EMDKManager.getGInstance(); // ProfileManager profileManager = (ProfileManager) emdkManager.getInstance(EMDKManager.FEATURE_TYPE.PROFILE); // // String profileXML = " // // // // "; // // String result = profileManager.processProfile(profileXML); // // Handle the result string to check for success or failure ``` -------------------------------- ### Compiling with Older Gradle (Pre-v7.0) Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/setup Configuration for older Gradle versions (prior to v7.0) to compile EMDK for Android. It includes JCenter repository and specific dependency versions. ```gradle repositories { google() jcenter() } dependencies { classpath 'com.android.tools.build:gradle:3.1.2' } dependencies { compileOnly 'com.symbol:emdk:9.1.1' } ``` -------------------------------- ### Settings Gradle for Latest Gradle Plugins Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/setup Configuration within settings.gradle for projects using the latest Gradle plugins. It specifies repository modes and includes the Maven URL for EMDK dependencies. ```gradle dependencyResolutionManagement { repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) repositories { google() mavenCentral() jcenter() // Warning: this repository is deprecated; no updates allowed maven { url = "https://zebratech.jfrog.io/artifactory/EMDK-Android/" } } } ``` -------------------------------- ### EMDK Feature Characteristic Node Example (AppMgr) Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/xmlresponseguide This XML snippet illustrates a feature characteristic node, specifically for 'AppMgr' (Application Manager) with version '5.1'. It includes parameters like 'emdk_name' for unique identification within the profile, 'Action' to specify the operation (e.g., 'Install'), and 'APK' for the application package path. ```xml ``` -------------------------------- ### Gradle Repositories for EMDK 9.1.1 and Later Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/setup Configures the Maven repository for EMDK 9.1.1 and later releases. This uses a specific URL to resolve EMDK dependencies. ```gradle repositories { maven { url = "https://zebratech.jfrog.io/artifactory/EMDK-Android/" } } ``` -------------------------------- ### AndroidManifest.xml Queries Element for Android 11 Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/setup This XML snippet illustrates the inclusion of the `` element within the `AndroidManifest.xml` file, specifically targeting the EMDK service package. This is a crucial step for apps running on Android 11 and newer to ensure proper communication with the EMDK service. ```xml ... ... ``` -------------------------------- ### EMDK Configuration and Profile Processing Example Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/xmlresponseguide Demonstrates how to configure profiles using an EMDKConfig.xml file and process these profiles using the ProfileManager in Java. It also explains how feature names and types are derived from the XML structure. ```APIDOC ## EMDK Configuration and Profile Processing ### Description This section provides an example of an `EMDKConfig.xml` file used for defining device profiles, specifically a 'ClockProfile-1'. It also includes a Java code snippet demonstrating how to use the `ProfileManager` to process these profiles, including updating specific parameters like date and time for features within the profile. ### Example XML Configuration (`EMDKConfig.xml`) ```xml ``` ### Example Java Code for Profile Processing ```java String[] extraData = new String[2]; extraData[0] = "Clk01.Date=2014-10-10" extraData[1] = "Clk02.Time=10:10:10" profileName = "ClockProfile-1/Clock/Clk01" EMDKResults result = mProfileManager.processProfile( profileName, ProfileManager.PROFILE_FLAG.SET, extraData); ``` ### Explanation - `profileName`: Formatted as `ProfileName/featureType/featureName`. - `ProfileName`: The value of the `ProfileName` parm in the `Profile` characteristic (e.g., "ClockProfile-1"). - `featureType`: The type of the feature characteristic (e.g., "Clock"). - `featureName`: The value of the `emdk_name` parm within the feature characteristic (e.g., "Clk01"). - `extraData`: An array of strings, where each string is a name-value pair used to override or set specific parameters within the profile features. Format: `featureName.parameterName=parameterValue`. ``` -------------------------------- ### Configure Package Visibility for Android 11+ in AndroidManifest.xml Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/setup For applications targeting Android 11 (API 30) or later, this XML snippet shows the required `` element to declare that your app needs to interact with the EMDK service. This addresses Android's package visibility restrictions. ```xml ... ``` -------------------------------- ### Enable EMDK Permissions in AndroidManifest.xml Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/setup This XML snippet demonstrates how to declare the necessary EMDK permission in the `AndroidManifest.xml` file. This permission is required for your application to interact with the EMDK services provided by Zebra devices. ```xml ... ``` -------------------------------- ### Get Image Data from Byte Array (Java) Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/signaturecapture Extracts the image data from a larger byte array. It uses `Arrays.copyOfRange` to select a portion of the byte array, assuming the image data starts at a specific offset (byte index 6 in this example). ```java byte[] sigDataArr //holds the total signature data byte array byte[] imgDataArr = Arrays.copyOfRange(sigDataArr, 6, sigDataArr.length); ``` -------------------------------- ### Get SAM Slot Index Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/samapiusage This Java code retrieves the index of the SAM slot on the device. The index starts from 1 and identifies the specific physical slot the SAM occupies. ```java int index = sam.getSamIndex(); ``` -------------------------------- ### Install Client Certificate and Private Key (.PFX) using XML Provisioning Source: https://techdocs.zebra.com/emdk-for-android/14-0/mx/certmgr This XML snippet configures the installation of a client certificate along with its private key using a .PFX file. It specifies the certificate alias, type, method, the path to the .PFX file, and the private key password. This method also supports .P12 and .PKCS12 files. ```xml ``` -------------------------------- ### Complete Android Manifest Configuration for EMDK Source: https://techdocs.zebra.com/emdk-for-android/14-0/tutorial/tutMxWiFiManager This example displays a simplified version of an AndroidManifest.xml file after incorporating both the EMDK permission and library declarations. It serves as a reference for the final configuration required. ```xml ... ``` -------------------------------- ### XML Provisioning: Install Encryption Key (Output) Source: https://techdocs.zebra.com/emdk-for-android/14-0/mx/encryptmgr This XML snippet shows the output structure after an encryption key has been installed using the EncryptMgr characteristic. It includes parameters for the installation action and details of the installed key, such as its name. ```xml ``` -------------------------------- ### Install or Upgrade Application Source: https://techdocs.zebra.com/emdk-for-android/14-0/mx/appmgr This endpoint handles the installation or upgrade of applications using APK files or app bundles. It supports both user and system app installations/upgrades, with specific rules for signing and app bundle formats. ```APIDOC ## POST /api/apps/install ### Description Installs or upgrades an application on the device using an APK file or an app bundle. ### Method POST ### Endpoint /api/apps/install ### Parameters #### Request Body - **APK** (string) - Required - The full path and name of the device-resident `.apk`, `.apks`, `.xapk`, or `.zip` file. For example: `/enterprise/appmgr/Herald.apk`. - **Package** (string) - Optional - The Package Name(s) of one or more applications. Separate multiple Package Names using commas. This is shown if the Action is 'Install' or 'Upgrade'. - **PackageSignature** (string) - Optional - The name of the certificate file for signing the application(s) specified in the Package name parameter. This is shown if the Protected List Action is 'Reserve Application UID'. - **ApplicationName** (string) - Optional - The Name of the application for the selected Action. This is shown if the Action is 'Launch an application'. ### Request Example ```json { "APK": "/enterprise/appmgr/MyApplication.apk", "Package": "com.mycompany.myapp", "ApplicationName": "My Application" } ``` ### Response #### Success Response (200) - **status** (string) - The status of the installation/upgrade operation. - **message** (string) - A message detailing the result of the operation. #### Response Example ```json { "status": "success", "message": "Application installed successfully." } ``` ``` -------------------------------- ### Get SimulScanReader using Internal Camera Identifier Source: https://techdocs.zebra.com/emdk-for-android/14-0/guide/simulscan_guide This Java code shows how to get a SimulScanReader instance using the INTERNAL_CAMERA1 identifier. It includes basic error handling for SimulScanException. ```java try { simulscanManager.getDevice(SimulScanDeviceIdentifier.INTERNAL_CAMERA1); } catch (SimulScanException e) { e.printStackTrace(); } ``` -------------------------------- ### OS Update Zip File Example Source: https://techdocs.zebra.com/emdk-for-android/14-0/mx/powermgr This snippet shows how to create an OS Update text file (.upl) containing a list of package zip files to be applied in order. This format is used for updating the device's OS. ```text //Contents of the "osupdate.upl" text file: package:M99N0KXXVPUCP14500.zip package:CFE-M99-L-N0-010101_G_00_02.zip // Note that package file names are preceded by the notation "package:" ``` -------------------------------- ### Get SimulScan Status State Source: https://techdocs.zebra.com/emdk-for-android/14-0/api/reference/deprecated-list This code example shows how to get the current state of a SimulScan reader. It calls the getState() method from the SimulScanStatusData class. This feature is supported only on devices prior to Android 10 Q. ```Java SimulScanStatusData.getState(); ``` -------------------------------- ### UI Elements for Default Launcher Setup (XML) Source: https://techdocs.zebra.com/emdk-for-android/14-0/tutorial/tutMxDefaultLauncher Defines the UI elements within the activity_main.xml layout file. It includes a TextView for a label, an EditText for the user to input the package name of the launcher application, and a Button to trigger the default launcher setting process. ```XML