Skip to main content
EMS Software, LLC

Configuring and Re-Signing the EMS Mobile App (Private Deployment Only)

Using Unsigned Builds

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

  1. Store your unsigned EMS Mobile App in a new or empty directory.
  2. Change the extension of the app to .zip. (e.g., IPhone.App-44.1.xxx-unsigned.ipa -> IPhone.App-44.1.xxx-unsigned.zip.)
  3. Un-compress/expand the new zip file.

Setting Custom Configuration

  1. Refer to Customizing Your Configuration Using config.json for details on building a configuration file for EMS Mobile. 
  2. Replace the config.json file with your custom configuration (located as follows):
IOS
  • config.json (top-level file)

Android
  • assets/config.json

Re-Signing and Repackaging for iOS

Follow the steps below to re-sign and repackage for iOS.

1. Install Fastlane.

Using, sudo gem install fastlane on an administrative Apple computer.

2. Install Certificate & Provisioning Profile

If your Apple computer is already configured with these items, these steps may not be necessary. 

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

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.

3. Re-Signing

Assuming you have:

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

...then you should be ready to re-sign the application. Before you proceed, 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 with to use, or remove the parameter if you do not wish to rename the application

Note: 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

Re-Signing and Repackaging 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-44.1.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