Configure and Re-Sign the EMS Mobile App (Private Deployment Only)

This topic provides information on the following:

ClosedUse unsigned builds

For customers re-signing the application, we provide unsigned builds.

To use unsigned builds:

  1. Store your unsigned EMS Mobile App in a new or empty directory.
  2. Change the extension of the app to .zip. 

    For example, IPhone.App-220.xxx-unsigned.ipa -> IPhone.App-220.xxx-unsigned.zip.

  3. Un-compress/expand the new zip file.

ClosedSet custom configuration

To set custom configuration:

  1. Refer to Customize Your Mobile App Configuration Using config.json (Private Deployment Only) for details on building a configuration file for the EMS Mobile App. 
  2. Replace the config.json file with your custom configuration, located as follows:

IOS

config.json (top-level file)

Android

assets/config.json

ClosedRe-sign and re-package for iOS

To re-sign and re-package for iOS:

  1. Install Fastlane.

    Use Sudo Gem to install on an administrative Mac computer.

  2. Install Certificate and Provisioning Profile.

    If your Mac computer is already configured with these items, these steps might not be necessary. 

    To install Certificate:

    See Apple's documentation for installing and managing certificates and signing identities. When the certificate is installed successfully, you should see iPhone Distribution: Your Company, Inc in your Keychain, with a private key.

    To install Provisioning Profile:

    1. Login to https://developer.apple.com.
    2. Download your Distribution provisioning profile.
    3. Double click it to install it. This file should exist on your system:
      • ~/Library/MobileDevice/Provisioning Profiles/<profile-guid>.mobileprovision
  3. Re-sign the EMS Mobile App.

    If you have the following, you should be ready to re-sign the EMS Mobile App.

    • Fastlane installed on your Apple computer
    • the cert and private key installed in Keychain
    • the provisioning profile mentioned above in ~/Library/.../<profile-guid>.mobileprovision

    Before proceeding, change the following in the command below:

    • Replace path/to/your/file.ipa with the real path to the ipa file
    • Replace iPhone Distribution: Your Company, Inc with the appropriate signing identity on your machine
    • Replace <profile-guid> with the actual GUID or name of the provisioning profile you intend to use
    • Replace EMS-Resigned with the display name you want to use, or remove the parameter if you do not want to rename the application

    Running these commands will overwrite the ipa file you designate. Make a copy first if necessary.

    fastlane run resign \
        ipa:path/to/your/file.ipa \
        signing_identity:"iPhone Distribution: Your Company, Inc" \
        provisioning_profile:$HOME/Library/MobileDevice/Provisioning Profiles/<profile-guid>.mobileprovision \
        display_name:EMS-Resigned

    (All on one line for copy/paste:)

    fastlane run resign ipa:path/to/your/file.ipa signing_identity:"iPhone Distribution: Your Company, Inc" 
    provisioning_profile:$HOME/Library/MobileDevice/Provisioning Profiles/<profile-guid>.mobileprovision 
    display_name:EMS-Resigned

    If you want a bash script that will do this, you can copy this into a file (e.g., resign_enterprise.sh):

    #!/bin/bash

    IPA=relative/path/to/file.ipa
    IDENTITY="iPhone Distribution: Your Company, Inc"
    PROFILE=$HOME/Library/MobileDevice/Provisioning\ Profiles/<profile-guid>.mobileprovision
    DISPLAY_NAME=EMS-Resigned

    fastlane run resign ipa:"$IPA" signing_identity:"$IDENTITY" provisioning_profile:"$PROFILE" display_name:$DISPLAY_NAME

ClosedRe-zip and re-package for Android

To re-zip and re-package for Android:

  • Re-zip all the extracted files from earlier
    • Note that assets, res, and AndroidManifest.xml are top-level files in an .apk, so be careful to zip the right files
    • This CLI command will zip all the files in the current directory into a new zip file in the parent directory:
      • zip -qr ../ems-custom-220.xxx.zip ./*
  • Give the new zip file an .apk extension
    • e.g., myapp.zip -> myapp.apk
  • Sign the new .apk file, for example:

    #!/bin/bash

    APK_TO_SIGN=$1
    APK_OUTPUT=$2
    EMS_APK_KEYSTORE_PATH=path/to/your/app.keystore

    jarsigner -verbose \
        -sigalg $EMS_APK_SIG_ALG \
        -digestalg $EMS_APK_DIGEST_ALG \
        -storepass $EMS_APK_KEYSTORE_PASS \
        -keystore $EMS_APK_KEYSTORE_PATH \
        $APK_TO_SIGN $EMS_APK_ALIAS_NAME

    zipalign 4 $APK_TO_SIGN $APK_OUTPUT