1 Reply Latest reply on Aug 14, 2013 6:27 AM by Allan Herrod

    sending a command to Android via an MSP package

    Afshin Mansoorieh

      i am trying to use MSP to send a command to my MC40.  specifically, i want to send the following command which i am able to do via "adb Shell":

       

      "am broadcast -n com.motorolasolutions.fusion.xmlintentloader/.FusionXMLLoaderReceiver"

       

      has anyone tried something similar?  i tried creating a package with no files and just the text above in the "install commands" field but it didn't work.

       

      thanks,

      afshin

        • Re: sending a command to Android via an MSP package
          Allan Herrod

          Afshin;

           

          No, you cannot execute ADB commands in any way from MSP.  The only thing you can put in Commands in a Package are commands that are understood by the MSP Agent.  On Android Devices, there are FIVE supported commands: COMPLETEJOB (used to complete a job immediately if later commands will cause a reboot such as in an OS Update), SLEEP (used to wait a bit before proceeding), INSTALL (used to install APK files), UNINSTALL (used to uninstall APK files), and LAUNCHACTIVITY (used to send intents, such as to launch an APK, initiate an OS Update, etc.).  Unlike in Windows, where Commands in a Package can run EXE files, this is not possible in Android, so the rest of the commands supported on Windows (which all relate to running EXE files) are not supported.

           

          ADB is a privileged application and, so far as I know, cannot be used directly by other applications on the device.  I am not sure what the ADB command you are using is trying to accomplish, but if it is trying to send and intent, then the LAUNCHACTIVITY command MIGHT work, although it can only launch activities, not services.  If you can obtain an APK that does what you want to do, and if that APK can be launched with an intent, then you can use MSP to deploy, install, and launch that APK. Such an approach can do some (but not all) of the things that deploying and running an EXE file could do on Windows.  Be aware that the APK might need to be signed if it wants to do anything privileged.  The fact that it is launched by MSP won't give it any special permissions.

           

          Allan