简体   繁体   中英

Detect if mobile app was installed from Production Track or Beta Track in AppStore/Play Store

I have a Mobile App for Both Android and iOS , both are built using Xamarin.

Android - The app is uploaded to the play store on the Beta Track and once testing is completed it is promoted the Production Track .

iOS - The app is uploaded to Test Flight once testing is completed a new release is created in AppStoreConnect, the build is set to the app currently in test flight and then set ready for sale (therefore showing in the Apple AppStore ).

Is there a way to detect in the Mobile App if the App was installed from the Beta Track or Production Track in Play Store (for Android). And for iOS detect if the app was installed from Test flight or the App Store?

I also have 2 different WCF Web services that the mobile app connects to, one is the Beta services and the other is the Production services, these endpoints are hard coded in the app.

What I am trying to accomplish is when the app is installed from the Production Track/App Store then connect to the Production services endpoint, when the app is installed from anywhere else (ie Beta Track/Test Flight) then use the Beta services.

What I am currently doing is when the app opens the user is given the choice to pick between the 2. When it comes to doing a production release I remove this choice from the user and just make the app go to production only. I would preferably like the choice to be made based upon where the user installed the app from.

To be clear, the purpose of this is to build a single APK/IPA app that can be used for both Beta and Production.

UPDATE - There have been some interesting suggestions using the API to re-route the web services calls based on version number, but these still involve building separate APK files for Beta and Production versions of the app (which doesn't solve the question). As for what I'm trying to accomplish with Detecting installs from the Beta Track, it looks as though this is not currently possible.

Might be a bit late for you, but that answer can still help others...

It is possible to find the installation source on iOS as such:

#if DEBUG
    // XCODE INSTALL
#else
    NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
    NSString *receiptURLString = [receiptURL path];
    BOOL isRunningTestFlightBeta =  ([receiptURLString rangeOfString:@"sandboxReceipt"].location != NSNotFound);
    if (isRunningTestFlightBeta) {
        // TESTFLIGHT INSTALL
    }
    else {
        // STORE INSTALL
    }
#endif

I still don't have an answer for Android though.

I believe it's not possible as of now. But if you want to test your same android build against two different domain sets of API, you can make use of content provider approach. You can create a admin/utility kind of app, which will pass/update the domain in your original app through the use of content providers .

I followed the same practice in one of my product and its really cool.

I would preferably like the choice to be made based upon where the user installed the app from.

This is a good question.

Generally,we not need to know directly where user installed from the app or Test Place.We can Using Version Tracking to know whcih version of user installed first.Then from version vode we can know where installed.

Maybe you will have a doubt why can know. Yes, your doubt is normal. But I want to say it actually can know where installed. It depends on how you design version code when develop app.

For example: If define a realease version code as 1.0 , and define a test version code as 1.0.1 . When publish a realease version, there are only one point else will have two point in version code. When running app, you can check by this rule to know where version installed. This rule not always the same with the example. You can custom define your rule in app.

Last, getting vesion code can using Xamarin.Essentials to realize it:

var currentVersion = VersionTracking.CurrentVersion;

In addition, VersionTracking also can get other info from app, have a look at this document .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM