xamarin.androidmotorola-emdk

Error using Zebra MX extensions AppManager


I'm trying to use Zebra Mx extensions App Manager on Xamarin with the EMDK package. My device is a Zebra TC51 with Android 7.1

When I'm calling the function :

string[] modifyData = new string[2];
modifyData[0] = ProfileManager.CreateNameValuePair("AppMgrInstall", "Action", "Install");
modifyData[1] = ProfileManager.CreateNameValuePair("AppMgrInstall", "APK", "/storage/emulated/0/Android/data/mypackage/files/apks/install.apk");
EMDKResults results = arg.ProcessProfileAsync("AppMgrProfile", ProfileManager.PROFILE_FLAG.Set, modifyData);

The result is :

The processing of profile started, the result will be returned through the data listener callback registered

but the data listener is never called.

If I use the synchronous method ProcessProfile(), the app gets stuck indefinitely on the line.

When I look in logcat what happens on the device, I have this error that pops up :

AppList_AllowedSubmitXml ERROR: Unable to load static file

What can be the cause of the error?

How could I find more information related to this error?

I searched AppList_AllowedSubmitXml on Google search engine but it returned 0 results.

EDIT: Here is my EMDKConfig.xml

<?xml version="1.0" encoding="UTF-8"?><!--This is an auto generated document. Changes to this document may cause incorrect behavior.-->
<wap-provisioningdoc>
    <characteristic type="ProfileInfo">
        <parm name="created_wizard_version" value="7.3.2"/>
    </characteristic>
    <characteristic type="Profile">
        <parm name="ProfileName" value="AppMgrProfile"/>
        <parm name="ModifiedDate" value="2020-01-09 09:19:51"/>
        <parm name="TargetSystemVersion" value="8.0"/>
        <characteristic type="AppMgr" version="8.0">
            <parm name="emdk_name" value="AppMgrInstall"/>
            <parm name="Action" value="Install"/>
            <parm name="APK" value="/storage/emulated/0/Android/data/mypackage/files/apks/install.apk"/>
        </characteristic>
    </characteristic>
</wap-provisioningdoc>

Solution

  • You can't use the ProcessProfile API in that way, your project needs to have a corresponding EMDKConfig.xml file and modifyData() can only be used to modify the contents of that file prior to submission, if needed.

    It may be easiest to copy the WiFi sample from https://github.com/Zebra/samples-emdkforxamarin-4_0/tree/samples-emdkforxamarin-5_0/ProfileWifiSample1. That sample can enable / disable the WiFi amongst other tasks and you can modify the project XML to suit your needs using the EMDK for Xamarin Visual Studio extension (https://marketplace.visualstudio.com/items?itemName=EmdkForXamarin.EMDKforXamarin-19166) . The VS Extension gives you a visual editor, I would not recommend trying to modify the XML directly.

    I notice that the WiFiSample always modifies the XML in code before processing but this is not required - an example of an app that does not modify the xml before sending is https://github.com/darryncampbell/DevTalk-Securing-Your-Zebra-Device/blob/master/SecurityManagers/SecurityManagers/MainActivity.cs#L293

    Update (see comments): The following code will install a specified apk:

    string[] modifyData = new string[1];
    modifyData[0] = "<? xml version =\"1.0\" encoding=\"utf-8\"?>";
    modifyData[0] +=  "<characteristic type = \"Profile\" >";  
    modifyData[0] +=   "<parm name = \"ProfileName\" value = \"AppMgrProfile\" />";
    modifyData[0] +=   "<parm name = \"ModifiedDate\" value = \"2020-01-10 13:14:07\" />";
    modifyData[0] +=   "<parm name = \"TargetSystemVersion\" value = \"7.0\" />";
    modifyData[0] +=   "<characteristic type = \"AppMgr\" version = \"7.0\" >";
    modifyData[0] +=     "<parm name = \"emdk_name\" value = \"AppMgr\" />";
    modifyData[0] +=     "<parm name = \"Action\" value = \"Install\" />";
    modifyData[0] +=     "<parm name = \"APK\" value = \"/storage/emulated/0/install.apk\" />";
    modifyData[0] +=   "</characteristic>";
    modifyData[0] += "</characteristic>";
    EMDKResults results = arg.ProcessProfileAsync("AppMgrProfile", ProfileManager.PROFILE_FLAG.Set, modifyData);