### Allow Application Installs from Unknown Sources Example Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/devadmin Example of how to allow application installs from unknown sources. ```APIDOC ### Allow Application Installs from Unknown Sources ```xml ``` ``` -------------------------------- ### Install and Start Application using EMDK for Android Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/appmgr This snippet first installs an application using the `AppMgr` characteristic and then starts its main activity using the `Intent` characteristic. It requires specific parameters for both installation (`Action`, `APK`) and starting the activity (`Action`, `ActionName`, `Package`, `Class`). Requires Android API 26+ and MX 9.3+. ```xml ``` -------------------------------- ### Feature Characteristic Node Example (AppMgr) Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/xmlresponseguide This example demonstrates a characteristic node for a specific feature, in this case, 'AppMgr' (Application Manager). It includes attributes like 'type' and 'version', and parameters such as 'emdk_name', 'Action', and 'APK' for configuring application installation. ```xml ``` -------------------------------- ### Profile Management Example Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/xmlresponseguide Demonstrates how to use an EMDKConfig.xml file to define profile settings and then process these profiles using the ProfileManager in Java. ```APIDOC ## EMDKConfig.xml Example ```xml ``` ## Java Example Usage This example shows how to apply specific parameters to a profile. ### Method `ProfileManager.processProfile` ### Endpoint N/A (This is a client-side SDK method) ### Parameters #### Path Parameters N/A #### Query Parameters N/A #### Request Body - **profileName** (String) - Required - The name of the profile to process (e.g., "ClockProfile-1/Clock/Clk01"). - **flags** (ProfileManager.PROFILE_FLAG) - Required - Flags for processing the profile (e.g., `SET`). - **extraData** (String[]) - Optional - An array of strings, where each string is a name-value pair to override or set specific parameters within the profile. ### Request Example ```java String[] extraData = new String[2]; extraData[0] = "Clk01.Date=2014-10-10"; extraData[1] = "Clk02.Time=10:10:10"; String profileName = "ClockProfile-1/Clock/Clk01"; EMDKResults result = mProfileManager.processProfile(profileName, ProfileManager.PROFILE_FLAG.SET, extraData); ``` ### Response #### Success Response (EMDKResults) - **statusCode** (EMDKResults.EMDKResult) - Indicates the result of the profile processing. - **errorMessage** (String) - Contains an error message if the processing failed. #### Response Example ```json { "statusCode": "SUCCESS", "errorMessage": null } ``` ### Notes The `profileName` format is `ProfileName/FeatureType/FeatureName` (where `FeatureName` is often the `emdk_name` from the XML). ``` -------------------------------- ### Get Key List Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/encryptmgr This query retrieves a list of installed keys available for encryption operations. ```APIDOC ## Get Key List ### Description Retrieves a list of keys that have been installed and are available for use in encryption operations. ### Method GET (Implied, as it queries a list) ### Endpoint `/websites/techdocs_zebra_emdk-for-android_8-0/EncryptMgr` ### Parameters #### Query Parameters - **InstallKey** (characteristic-query) - Required - Specifies that a query for installed keys should be performed. ### Request Example ```xml ``` ### Response #### Success Response (200) Returns a list of installed keys. #### Response Example (XML structure listing the available keys) ``` -------------------------------- ### Install Application using EMDK for Android Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/appmgr Installs an application (APK file) on the device. Requires the `Action` parameter set to 'Install' and the `APK` parameter specifying the path to the APK file. This functionality is available for Android API 26+ and MX 9.3+. ```xml ``` -------------------------------- ### SimulScanReader Example Usage Source: https://techdocs.zebra.com/emdk-for-android/8-0/api/reference/index-files/index-19 Demonstrates how to get supported devices, obtain a reader instance, add listeners, enable the reader, set a template, initiate a read operation, and cancel/disable the reader. This code is intended for use with the SimulScan API. ```Java List readerInfoList = simulscanManager.getSupportedDevicesInfo(); SimulScanReader reader = simulscanManager.getDevice(readerInfoList.get(0)); reader.addDataListener(callbackObj); reader.addStatusListener(callbackObj); reader.enable(); // Set template before calling read reader.read(); reader.cancelRead(); reader.disable(); ``` -------------------------------- ### Install Client Certificate and Private Key (PFX) Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/wifi Configures the device to install a client certificate along with its private key from a PFX file. Requires specifying the certificate alias, type, method, file path, and the private key password. The CertType value '8' indicates a PFX file. The CertMethod '2' is typically used for file-based installation. ```xml ``` -------------------------------- ### Install Client Certificate and Private Key (P12) Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/wifi Configures the device to install a client certificate and private key from a P12 file. Requires specifying the certificate alias, type, method, file path, and the private key password. The CertType value '9' indicates a P12 file. The CertMethod '2' is typically used for file-based installation. ```xml ``` -------------------------------- ### Query Install Apps from Unknown Sources Status Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/devadmin Query to retrieve the status of whether application installs from unknown sources are allowed. ```APIDOC ### Get Install Apps from Unknown Sources Status #### Input ```xml ``` #### Output ```xml ``` ``` -------------------------------- ### XML Provisioning: Successful RemoteScannerMgr and AppMgr Configuration Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/xmlresponseguide This example shows a successfully submitted XML profile that configures both RemoteScannerMgr and AppMgr features. The Profile Manager validates the input, and the response indicates a successful operation. ```xml ``` ```xml ``` -------------------------------- ### Submit Profile XML with DataCapture and Non-DataCapture Features Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/xmlresponseguide This XML demonstrates submitting a profile that includes both DataCapture settings and non-DataCapture features, such as application installation. The response indicates 'CHECK_XML' if there are issues, like a missing APK. ```xml ``` -------------------------------- ### Initialize EMDKManager and Get Profile Manager Async (Java) Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/xmlresponseguide This snippet demonstrates how to initialize the EMDKManager using `getEMDKManager` and then asynchronously retrieve a ProfileManager instance via `getInstanceAsync`. It handles success and failure cases during initialization and implements callbacks for when the EMDK is opened and when status updates are received. It also includes cleanup logic in `onDestroy` and `onClosed`. ```java public class MainActivity extends Activity implements EMDKListener, EMDKManager.StatusListener{ //Declare a variable to store ProfileManager object private ProfileManager profileManager = null; //Declare a variable to store EMDKManager object private EMDKManager emdkManager = null; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //The EMDKManager object will be created and returned in the callback. EMDKResults results = EMDKManager.getEMDKManager(getApplicationContext(), this); //Check the return status of EMDKManager object creation. if(results.statusCode == EMDKResults.STATUS_CODE.SUCCESS) { //EMDKManager object creation success }else { //EMDKManager object creation failed } } @Override protected void onDestroy() { super.onDestroy(); //Clean up the objects created by EMDK manager if (profileManager != null) profileManager = null; if (emdkManager != null) { emdkManager.release(); emdkManager = null; } } @Override public void onClosed() { //This callback will be issued when the EMDK closes unexpectedly. if (emdkManager != null) { emdkManager.release(); emdkManager = null; } } @Override public void onOpened(EMDKManager emdkManager) { this.emdkManager = emdkManager; //Get the ProfileManager object using async to process the profiles try { emdkManager.getInstanceAsync(EMDKManager.FEATURE_TYPE.PROFILE, MainActivity.this); } catch (EMDKException e) { e.printStackTrace(); } } @Override public void onStatus(EMDKManager.StatusData statusData, EMDKBase emdkBase) { if(statusData.getResult() == EMDKResults.STATUS_CODE.SUCCESS) { if(statusData.getFeatureType() == EMDKManager.FEATURE_TYPE.PROFILE) { profileManager = (ProfileManager)emdkBase; } } else { //Error occurred } } } ``` -------------------------------- ### Install Client Certificate (.PEM) with XML Provisioning Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/certmgr Installs only the public part of a client certificate using an XML provisioning document. This method is typically used when the private key is already installed or when renewing a public certificate without changing the private key. Requires specifying certificate details. ```xml ``` -------------------------------- ### Install Client Certificate (PEM) Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/wifi Configures the device to install a client certificate from a PEM file. Requires specifying the certificate alias, type, method, and file path. The CertType value '6' indicates a client certificate. The CertMethod '2' is typically used for file-based installation. ```xml ``` -------------------------------- ### onCreate Method - UI Initialization and EMDK Setup Source: https://techdocs.zebra.com/emdk-for-android/8-0/tutorial/tutsimulscanapi Initializes the UI elements, sets up listeners, and requests the EMDKManager instance. It also includes error handling for the EMDKManager request. ```APIDOC ## POST /onCreate ### Description Initializes UI elements from XML, sets up onclick listeners for buttons, and requests the EMDKManager. It checks if the EMDK is ready and handles potential errors during the EMDKManager request. ### Method POST ### Endpoint /onCreate ### Parameters #### Request Body - **emdkManager** (EMDKManager) - Required - The EMDKManager instance obtained asynchronously. - **results** (EMDKResults) - Required - The results of the EMDKManager request. - **textViewStatus** (TextView) - Required - The UI element to display status messages. - **deviceSelectionSpinner** (Spinner) - Required - The UI element for selecting devices. - **readButton** (Button) - Required - The button to start reading. - **stopReadButton** (Button) - Required - The button to stop reading. ### Request Example ```json { "emdkManager": "EMDKManager object", "results": {"statusCode": "SUCCESS"}, "textViewStatus": "TextView object", "deviceSelectionSpinner": "Spinner object", "readButton": "Button object", "stopReadButton": "Button object" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success or failure of the operation. #### Response Example ```json { "status": "EMDKManager object request successful!" } ``` ``` -------------------------------- ### Get SAM Type and Index Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/samapiusage Illustrates how to determine the type of the connected SAM (e.g., MIFARE, CALYPSO, FELICA) and retrieve its slot index on the device. The `getSamIndex()` method returns the index starting from 1. ```java SAMType samType = sam.getSamType(); int index = sam.getSamIndex(); ``` -------------------------------- ### Query Home Key Usage - XML Provisioning Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/uimgr This XML provisioning example shows how to query the usage status of the device's home key. It utilizes the 'parm-query' tag to retrieve the 'HomeKeyUsage' parameter. ```xml ``` -------------------------------- ### SAM API Programmer's Guide Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/samapiusage This section details the setup and core functionalities of the EMDK for Android SAM API for secure NFC interactions. ```APIDOC ## EMDK for Android SAM API Programmer's Guide ### Overview The EMDK for Android Secure Access Module (SAM) API provides developers with a comprehensive set of tools to easily create secure NFC applications for use with Zebra mobile devices. It's important to note that **the EMDK SAM API allows only for secure communication with the NFC tags**. The SAMManager is the primary object used to enumerate available SAMs and access SAMs to securely communicate with tags. Applications should use the Android NFC APIs to read standard NFC tags. * * * ### Update Android Manifest 1. Add the following permissions in the Android Manifest: ``` ``` 2. In the manifest's node, add the following line to enable use of EMDK libraries on the device: ``` ``` 3. Determine whether NFC is supported by the device by running the following code: ``` if (NfcAdapter.getDefaultAdapter(this) == null) { Toast.makeText(this, "NFC Not Supported", Toast.LENGTH_SHORT).show(); finish(); return; } ``` If NFC is supported, continue to the next step. * * * ### Get the SAM Manager An EMDK Manager object must be acquired before getting the SAM Manager object, and must release the SAM Manager class before quitting. Use the code below to get the SAM Manager: ``` samManager = (SAMManager) emdkManager.getInstance(EMDKManager.FEATURE_TYPE.SAM); ``` * * * ### Enumerate SAM Objects The `enumerateSAMs()` call returns a list of SAM objects present in the device. An empty list indicates that no SAMs are present. Call the `enumerateSAMs()` method to enumerate the available SAMs in the device: ``` List samList = null; try { samList = samManager.enumerateSAMs(); }catch (SAMException ex){ Log.d(TAG, SAMResults.getErrorDescription(ex.getResult())); } if(samList != null && samList.size()>0) { SAM sam = samList.get(0); } ``` * * * ### Using the SAM To use a SAM, a connection must be made with the SAM. Zebra recommends disconnecting the SAM when communications are concluded. 1. Get SAM type: ``` getSAMType() //returns the SAM type (i.e. MIFARE, CALYPSO, FELICA) SAMType samType = sam.getSamType(); ``` 2. Use the `connect()` method to connect to a SAM: ``` if (!sam.isConnected()) { try { sam.connect(); } catch (SAMException ex) { Log.d(TAG, SAMResults.getErrorDescription(ex.getResult())); return; } } ``` #### Notes * If another SAM is already connected, `connect()` throws and exception. * The `isConnected()` method returns the current SAM connection status. * Exceptions will be thrown if: * The called SAM is already connected with the current application * Another SAM connected with the current application * A different app is connected to the SAM * * * ### Transceive API The basic unit of communication between an NFC reader and a tag is the Application Protocol Data Unit, or APDU. Use the `transceive()` method is used to send the APDUs to the SAM. **To send an ADPU** : ``` byte[] getVersionAPDU = new byte[]{(byte) 0x80, (byte) 0x60, (byte) 0x00, (byte) 0x00,/*(byte)0x00,*/(byte) 0x00}; byte[] response = null; try { response = sam.transceive(getVersionAPDU, (short) 0, false); } catch (SAMException ex) { Log.d(TAG,SAMResults.getErrorDescription(ex.getResult())); } ``` #### Notes * Exceptions will be thrown if: * SAM is not connected * A SAM is having an active connection by a different application * Failure to transceive data * * * ### Disconnect SAM Use the `disconnect()` method to close the SAM connection. The SAM must be closed after all communications are done. Failure to do so might prevent other apps from using SAM APIs. **To disconnect SAM** : ``` if (sam.isConnected()) { sam.disconnect(); } ``` ### Get SAM Index The `getSamIndex()` method returns the slot index of the SAM starting from 1. **To get the SAM slot index** : ``` int index = sam.getSamIndex(); ``` * * * ### Detect NFC Tag The sample code below shows how to use Android NFC APIs to detect an NFC tag and establish a connection with an appropriate SAM using the EMDK SAM API's `connect()` method. ``` -------------------------------- ### Sample Android Manifest File Properties Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/powermgr An example of an Android manifest file ('Properties' XML) detailing various product, build, BSP, and device configurations for Zebra devices. It includes information such as product name, model, build ID, SDK version, and more. ```xml ``` -------------------------------- ### Get Unknown Sources Installation Status Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/devadmin Retrieves the current status of whether applications can be installed from unknown sources. This query targets the UnknownSourcesStatus parameter within the DevAdmin characteristic. Requires Android API 26+ and MX 10.0+. ```xml ``` -------------------------------- ### Install Client Certificate and Private Key (.PFX, .P12, .PKCS12) with XML Provisioning Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/certmgr Installs a client certificate along with its private key using an XML provisioning document. Supports PKCS12 encoded files such as .PFX, .P12, and .PKCS12. Requires specifying certificate details and the private key password for decryption. ```xml ``` -------------------------------- ### Start SimulScanReader Scan Operation (Java) Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/simulscan_guide Starts a scan operation using the SimulScanReader.read() API after enabling the reader and setting a template. The read operation can be canceled with cancelRead(). It is recommended to check isReadPending() before initiating a new read to avoid failures. ```Java try { if(!selectedSimulScanReader.isEnabled()) selectedSimulScanReader.enable(); } catch (SimulScanException e) { e.printStackTrace(); } ``` -------------------------------- ### Get SimulScanReader using Internal Camera Identifier Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/simulscan_guide This Java code snippet shows how to get a SimulScanReader instance for the internal camera using the SimulScanDeviceIdentifier. It includes a try-catch block to handle potential SimulScanException if the identifier is not valid for the target platform. ```java try { simulscanManager.getDevice(SimulScanDeviceIdentifier.INTERNAL_CAMERA1); } catch (SimulScanException e) { e.printStackTrace(); } ``` -------------------------------- ### Scanner Initialization and Enabling Source: https://techdocs.zebra.com/emdk-for-android/8-0/tutorial/tutbasicscanningapi Initializes and enables the scanner, setting up data and status listeners. Explains the `enable()` method and potential `ScannerException`. ```APIDOC ## Initialize Scanner ### Description Initializes and enables the scanner, setting up necessary listeners. The `enable()` method prepares the scanner hardware for use. It's important to note that `enable()` does not start scanning but makes the scanner available. Calling `enable()` when the scanner is already in use by another application will result in a `ScannerException`. ### Method `private void initializeScanner()` ### Endpoint N/A (Local method) ### Parameters None ### Request Example ```java private voidinitScanner() { if (scanner == null) { // Get default scanner defined on the device scanner = barcodeManager.getDevice(BarcodeManager.DeviceIdentifier.DEFAULT); if(scanner != null) { // Implement the DataListener interface and pass the pointer of this object to get the data callbacks. scanner.addDataListener(this); // Implement the StatusListener interface and pass the pointer of this object to get the status callbacks. scanner.addStatusListener(this); // Hard trigger. When this mode is set, the user has to manually // press the trigger on the device after issuing the read call. // NOTE: For devices without a hard trigger, use TriggerType.SOFT_ALWAYS. scanner.triggerType = TriggerType.HARD; try{ // Enable the scanner // NOTE: After calling enable(), wait for IDLE status before calling other scanner APIs // such as setConfig() or read(). scanner.enable(); } catch (ScannerException e) { updateStatus(e.getMessage()); deInitScanner(); } } else { updateStatus("Failed to initialize the scanner device."); } } } ``` ### Response N/A (Enables scanner and sets up listeners. May call `updateStatus` or `deInitScanner` on exception.) ``` -------------------------------- ### Get Notification Device via Enumeration - Java Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/notification-api This snippet demonstrates how to get a NotificationDevice by first enumerating all supported devices using getSupportedDevicesInfo(). It then iterates through the list to find a specific device (in this case, a Bluetooth SSI imager) and retrieves its NotificationDevice object. ```java List supportedDevList = notificationManager.getSupportedDevicesInfo(); NotificationDevice notificationObject = null; Iterator it = deviceList.iterator(); while(it.hasNext()) { DeviceInfo devInfo = it.next(); if(devInfo.getConnectionType()==BLUETOOTH_SSI&&devInfo.getDeviceType()==IMAGER){ notificationObject = notificationManager.getDevice(devInfo); break; } } ``` -------------------------------- ### Get Scanner using DeviceIdentifier without Enumeration Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/barcode_scanning_guide This Java code shows how to get a specific scanner device using its DeviceIdentifier. If the identifier is not supported on the target platform, the method will return null. This is a direct way to access a scanner without iterating through available devices. ```java Scanner scanner = barcodeManager.getDevice(DeviceIdentifier.BLUETOOTH_IMAGER_RS6000); ``` -------------------------------- ### Query AutoCorrect Usage - XML Provisioning Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/uimgr This XML provisioning example demonstrates querying the autocorrect feature's usage status. It uses the 'parm-query' tag to get the value of 'AutoCorrectUsage'. ```xml ``` -------------------------------- ### Access Manager Profile XML Example (Without Whitelist) Source: https://techdocs.zebra.com/emdk-for-android/8-0/tutorial/tutmxaccessmanager Provides a sample XML structure for configuring the Access Manager in 'Single User Mode Without White list'. This XML is directly passed to the `processProfile` method. ```xml modifyData[0] = "" + "" + "" + "" + "" + "" + ""; ``` -------------------------------- ### Getting Notification Device Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/notification-api Retrieve a NotificationDevice object using either a predefined DeviceIdentifier or by enumerating supported devices. ```APIDOC ## Getting Notification Device ### Description There are two primary methods to obtain a `NotificationDevice` object: directly using a `DeviceIdentifier` or by enumerating available devices and selecting one based on its `DeviceInfo`. ### Option 1: Get NotificationDevice using DeviceIdentifier #### Method `NotificationManager.getDevice(DeviceIdentifier deviceIdentifier)` #### Parameters - **deviceIdentifier** (`DeviceIdentifier`): Specifies the type of device to retrieve. - `BLUETOOTH_IMAGER_RS6000`: For the Ring Scanner "RS6000". - `EXTERNAL_VIBRATOR1`: For the pluggable External Vibrator. #### Request Example ```java NotificationDevice notificationDevice = notificationManager.getDevice(DeviceIdentifier.BLUETOOTH_IMAGER_RS6000); ``` #### Response - **notificationDevice** (`NotificationDevice`): The requested notification device, or `null` if the identifier is not supported on the target platform. ### Option 2: Get NotificationDevice using DeviceInfo from device enumeration #### Method 1. `NotificationManager.getSupportedDevicesInfo()` 2. `NotificationManager.getDevice(DeviceInfo deviceInfo)` #### Steps 1. Enumerate all supported devices using `getSupportedDevicesInfo()`. 2. Iterate through the list of `DeviceInfo` objects. 3. Select a `DeviceInfo` based on desired connection type and device type (e.g., `BLUETOOTH_SSI` and `IMAGER` for RS6000). 4. Obtain the `NotificationDevice` object using the selected `DeviceInfo`. #### Request Example ```java List supportedDevList = notificationManager.getSupportedDevicesInfo(); NotificationDevice notificationObject = null; Iterator it = supportedDevList.iterator(); while(it.hasNext()) { DeviceInfo devInfo = it.next(); // Example: Targeting RS6000 (Bluetooth SSI, Imager) if(devInfo.getConnectionType()==BLUETOOTH_SSI && devInfo.getDeviceType()==IMAGER){ notificationObject = notificationManager.getDevice(devInfo); break; } } ``` #### Response - **notificationObject** (`NotificationDevice`): The `NotificationDevice` corresponding to the enumerated `DeviceInfo`, or `null` if not found or applicable. ``` -------------------------------- ### Initialize Spinners and Adapters Source: https://techdocs.zebra.com/emdk-for-android/8-0/tutorial/tutMxAccessManager Demonstrates the initialization of Spinner UI elements and their corresponding ArrayAdapter instances. It shows how to populate spinners with string arrays defined in resources and attach them to the respective spinner views. This is a standard Android pattern for creating selectable lists. ```java // Reference for settings, Add Package and Delete Package drop downs settingsAccessSpinner = (Spinner) findViewById(R.id.settings_access_spinner); deletePackageSpinner = (Spinner) findViewById(R.id.delete_package_spinner); addPackageSpinner = (Spinner) findViewById(R.id.add_package_spinner); // Adapter to hold the list system settings menu options dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, getResources() .getStringArray(R.array.system_settings_array)); dataAdapter .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Set adapter to settings drop down settingsAccessSpinner.setAdapter(dataAdapter); // Adapter to hold the list delete package options dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, getResources() .getStringArray(R.array.delete_packages_array)); dataAdapter .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Set adapter to delete package drop down deletePackageSpinner.setAdapter(dataAdapter); // Adapter to hold the list add package options dataAdapter = new ArrayAdapter(this, android.R.layout.simple_spinner_item, getResources() .getStringArray(R.array.add_packages_array)); dataAdapter .setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); // Set adapter to add package drop down addPackageSpinner.setAdapter(dataAdapter); // Call to common On Item Selected Listener for all drop downs based on // view ID. settingsAccessSpinner.setOnItemSelectedListener(onItemSelectedListener); deletePackageSpinner.setOnItemSelectedListener(onItemSelectedListener); addPackageSpinner.setOnItemSelectedListener(onItemSelectedListener); ``` -------------------------------- ### License Choice Configuration Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/licensemgr Configure the method for performing license actions on the device, choosing between legacy Symbol actions or Zebra server-based actions. ```APIDOC ## License Choice Configuration ### Description This configuration sets the method for performing license actions on the device. It allows selection between 'Legacy' Symbol actions (using local license files) and 'Zebra' actions (pertaining to a server-based license store). ### Method PUT ### Endpoint /api/config/license/choice ### Parameters #### Query Parameters - **LicenseChoice** (integer) - Required - Specifies the license action method. Options are: - 0: do_nothing (Retain current setting) - 1: symbol (Perform legacy Symbol License Action) - 2: zebra (Perform Zebra License Action) ### Request Example ```json { "LicenseChoice": 2 } ``` ### Response #### Success Response (200) - **LicenseChoice** (integer) - The selected license action method. #### Response Example ```json { "LicenseChoice": 2 } ``` ``` -------------------------------- ### Getting Notification Manager Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/notification-api Obtain the NotificationManager instance from the EMDKManager. Ensure it's released before another application uses the feature. ```APIDOC ## Getting Notification Manager ### Description To use the Notification API, you must first obtain an instance of `NotificationManager` from the `EMDKManager`. It is crucial to release this instance when your application no longer needs it, to allow other applications access. ### Method `EMDKManager.getInstance(FEATURE_TYPE.NOTIFICATION)` ### Request Example ```java NotificationManager notificationManager = (NotificationManager) emdkManager.getInstance(FEATURE_TYPE.NOTIFICATION); ``` ### Response - **notificationManager** (`NotificationManager`): An instance of the NotificationManager. ### Important Note `EMDKManager > NotificationManager` used in an application must be released before another application can use this feature. ``` -------------------------------- ### OS Update File Example (.upl) Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/powermgr Demonstrates the structure of an OS update text file (.upl) used to specify multiple OS update packages (.zip files) for sequential application on Zebra devices. This format is supported on devices running Android 10 and later for reset commands. ```text //Contents of the "osupdate.upl" text file: package:M99N0KXXVPUCP14500.zip package:CFE-M99-L-N0-010101_G_00_02.zip ``` -------------------------------- ### Accessing EMDKManager Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/personalshopper This snippet shows how to get an instance of the EMDKManager class, which is the entry point for accessing various features supported by the EMDK. ```APIDOC ## Get EMDKManager Instance ### Description Obtain an instance of the EMDKManager to access different features of the EMDK for Android. ### Method Static method call ### Endpoint N/A ### Parameters None ### Request Example ```java EMDKManager emdkManager = EMDKManager.getEMDKManager(getApplicationContext(), this); ``` ### Response N/A ``` -------------------------------- ### License Method Configuration Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/licensemgr Select the method for supplying the Software License. Options include embedding the license file content directly into the XML or referencing a license file already present on the device. ```APIDOC ## License Method ### Description Used to enter the method of supplying the Software License. The 'Embed' option embeds the Base64-encoded license file content into the Request XML. The 'Reference' option references a Software License File by its path and file name, which must be present on the device. ### Method (Implicitly POST or PUT, as it's a configuration parameter) ### Endpoint (Not explicitly defined, assumed to be part of a larger license configuration API) ### Parameters #### Query Parameters - **LicenseAction** (string) - Required - Must be "Apply" - **LicenseChoice** (string) - Required - Must be "Symbol" #### Request Body - **LicenseMethod** (string) - Required - Specifies the license supply method. Accepts 'embed' or 'reference'. - **embed**: Embed the license blob from the license file into the XML. - **reference**: Reference a license file already on the device. ### Request Example ```json { "LicenseMethod": "embed" } ``` ### Response #### Success Response (200) - **status** (string) - Indicates the success of the operation. #### Response Example ```json { "status": "success" } ``` ### Requires - MX: 4.3+ ``` -------------------------------- ### Get SimulScanReader using Supported Devices Info Source: https://techdocs.zebra.com/emdk-for-android/8-0/guide/simulscan_guide This Java code demonstrates an alternative method to obtain a SimulScanReader. It first retrieves a list of supported devices' information using getSupportedDevicesInfo() and then uses the first device's info to get the reader instance. A try-catch block is included for error handling. ```java List readerInfoList = simulscanManager.getSupportedDevicesInfo(); try { simulscanManager.getDevice(readerInfoList.get(0)); } catch (SimulScanException e) { e.printStackTrace(); } ``` -------------------------------- ### Initialize Android KeyStore (XML) Source: https://techdocs.zebra.com/emdk-for-android/8-0/mx/wifi Initializes the Android KeyStore for certificate management. This operation must be performed before installing certificates. It can be done with or without a password. ```xml ``` ```xml ``` -------------------------------- ### Getting Error Description from SAMResults Source: https://techdocs.zebra.com/emdk-for-android/8-0/api/reference/com/symbol/emdk/sam/samresults Provides an example of using the `getErrorDescription` static method to retrieve a human-readable string description for a given SAMResults error code. ```java SAMResults errorCode = SAMResults.FAILED_TO_CONNECT; String description = SAMResults.getErrorDescription(errorCode); System.out.println("Error Description: " + description); ```