1 Reply Latest reply on Nov 29, 2017 12:50 PM by Daniel Silva

    Is there a way to close/kill a running application with the help of MX?

    Michael Stjernborg

      We are using stageNow in order to do various task on a MC18 Android (5.1.1).

      One of the MX components we are using is Condition Manager.

      If a certain condition is met we would like to close/kill an app. In this case Enterprise Browser 1.5.

      Is there a way to close an app with mx? Intent?

       

      /Michael

        • Re: Is there a way to close/kill a running application with the help of MX?
          Daniel Silva

          I had a customer who also needed a way to exit EB.  In this case they needed to exit EB when they started another app from the SOTI launcher,  so we put together a SOTI script to trigger EB to exit when the user pressed the icon for the second app,  but the same method should work for you.  The idea is to use the EB Intent API as the trigger,  and we used DOM injection to add some javascript to the pages to make it work because they did not have the ability to change the existing web app.  If you can change the web app, you could skip the dom injection part and do that right on the webserver.  See the EB docs for details on these features

          About Enterprise Browser 1.7 - Zebra Technologies TechDocs

           

          In config.xml,  set up the Intent receiver like this:

          <IntentReceiver>
             <EnableReceiver  value="1"/>
             <IntentAction  value="Intent.QUITEB"/>
             <IntentCategory  value=""/>
             </IntentReceiver>

           

          Set up dom injection in config.xml like this:

           <CustomDOMElements value="file://%INSTALLDIR%/myTags.txt"/> 

          myTags.txt and eb-exit.js go into the same folder as config.xml. ebapi-modules.js,eb.intent.js, and eb.application.js would also need to be copied to the device in the same folder as config.xml.  These files can be found on your PC in C:\EnterpriseBrowser\JavaScriptFiles\EnterpriseBrowser\Android

           

          content of myTags.txt below.  This will inject these 4 javacscript files into every page that EB navigates to:

          <script type='text/javascript' src='file:///sdcard/Android/data/com.symbol.enterprisebrowser/ebapi-modules.js' pages='*'/>
          <script type='text/javascript' src='file:///sdcard/Android/data/com.symbol.enterprisebrowser/eb.intent.js' pages='*'/>
          <script type='text/javascript' src='file:///sdcard/Android/data/com.symbol.enterprisebrowser/eb.application.js' pages='*'/>
          <script type='text/javascript' src='file:///sdcard/Android/data/com.symbol.enterprisebrowser/eb-exit.js' pages='*'/>

           

           

          Content of eb-exit.js below.  This sets up the intent API to start listening and the callback will quit EB if EB receives the intent it is looking for.

          function intentCB(data){

          if(data.action=="Intent.QUITEB"){

          EB.Application.quit();

          }

          }

          EB.Intent.startListening(intentCB)

           

          If the above is all configured properly,  you should see EB exit if you send a broadcast intent with the action "Intent.QUITEB".