Installing both staging and production iOS / Android apps on your device
Asked Answered
O

2

14

I have an app which is published on both App Store and Play Store already. The app published is pointing to my production server. What I want to do is to have my devices install a "staging" app which points to my staging server so I don't mess up with the real users during my development. So essentially, my device would have two of my apps - MyApp and MyApp_Staging. The staging app must be able to be distributed to my testers.

I use the Push Notification feature from Parse. How can the staging app has the same feature? Do I need another Developer account for staging app?

I have been looking at iOS Beta Testing features. It seems like my staging app has to be reviewed by Apple before I push to my testers. How can I skip the review process? For Android, the staged rollout seems like a good idea, but the staged app will be replacing the production app.

Is there a way to have both staging and production apps installed on devices?

Osugi answered 16/4, 2015 at 5:9 Comment(1)
You can have internal beta testers for iOS, which skips the approval step, but they need to be given admin or technical roles under your account, which is less than ideal.Pegues
B
21

For iOS:

I have staging and production app for iOS installed on the same device. I can't answer this for Android, but here is my set up for iOS with Parse push notifications.

A: Multiple versions of the app on the same device:

For both the apps to be installed on the same device they need to have different bundle identifiers. To do that:

  1. Open your project and go to the Info tab for your Target.
  2. Locate the setting for Bundle identifier
  3. Add a suffix at the end of the identifier as follows: com.MyApp$(BUNDLE_ID_SUFFIX)
  4. Now open the Build Settings tab and add a new User-Defined setting
  5. Set the name of the setting be BUNDLE_ID_SUFFIX
  6. Add a different suffix for each of the build configurations that you have. e.g. Debug could have the value .debug. Leave the suffix for the Release configuration empty. I have 3 build configurations with different suffixes.
    • Debug for testing as I am developing
    • Adhoc for releasing adhoc builds to testers.
    • Release for releasing to the App Store.
  7. If you follow this path, you will notice that all the versions of app installed on your device have the same name and it will be difficult to tell them apart.
  8. To fix that, go back to the Info tab and edit the setting for Bundle display name to say ${PRODUCT_NAME}${BUNDLE_DISPLAY_NAME_SUFFIX}
  9. Similar to what we did above create a new User-Defined setting with the name BUNDLE_DISPLAY_NAME_SUFFIX and add different values for each build configuration. e.g. mine say α and β.

The above will allow you to install multiple versions of the app on a single device.

B: Setup Push notifications using parse between the versions.

To set up Parse push notifications to work across these versions: Follow the Parse tutorial to create certificates and provisioning profiles for each of the bundle identifiers. e.g. I have 3 certificates/provisioning profiles for my 3 bundle identifiers:

  1. com.MyApp.debug is a Development profile for DEBUG.
  2. com.MyApp.adhoc is a AdHoc Production profile for Ad Hoc testing.
  3. com.MyApp is a AppStore Production profile for submitting to the App Store.

Make sure to set the right provisioning profiles in your Build Settings, so that the app is signed correctly.

Upload all the certificates to Parse.com. Parse allows you to have 6 different iOS push certificates.

C: Using different production and staging servers.

Set up preprocessing macros on Build settings tab. Search for Preprocessor and under Apple LLVM 6.1 - Preprocessing for the setting Preprocessor Macros setup different macros for each build configuration. e.g. mine say for Adhoc ADHOC=1, for Debug DEBUG=1

Then somewhere in your source code have something as follows:

#if defined(DEBUG)

#define SERVER <development server>

#else

#if defined(ADHOC)

#define SERVER <staging server>

#else

#define SERVER <production server>

#endif 

D: Sending builds to testers.

This topic has probably been covered multiple times. I am not fond of Apple's Beta test process. There are numerous other solutions. The one I like is Beta by Crashlytics.

You can read about it here: http://try.crashlytics.com/beta/

I deploy the AdHoc build configuration to testers as it is built with the Adhoc provisioning profile which allows me to deploy it on 100 devices without Apple approval.

Bebebebeerine answered 16/4, 2015 at 6:10 Comment(1)
For anyone who may find this, I only had Debug and Release build configurations. You can go to Editor > Add Configuration > Duplicate "Debug" Configuration to add an additional configuration (in my case, the "AdHoc" one). You need to make sure that the info tab is selected and the project is selected (not a specific target) to do this! See #19843246Bagehot
D
3

For Android

  • To install both on same device at the same time , use different package names for application

com.company.testapp - For the app in staging

com.company.live - For the app in live mode

  • For interaction with server use different URL(s) in both the apps e.g. store urls in some file and use same as static variables.

  • Deploy GCM/push notification code for both on different servers.

Determinable answered 16/4, 2015 at 5:42 Comment(1)
Thanks @prateek. It works well for me. For future viewers, here's a way to change the package name fast and nicely under Android Studio: #16804593Osugi

© 2022 - 2024 — McMap. All rights reserved.