Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AppCenter Distribute #225

Closed
joonmanji opened this issue Jan 18, 2018 · 23 comments
Closed

AppCenter Distribute #225

joonmanji opened this issue Jan 18, 2018 · 23 comments

Comments

@joonmanji
Copy link

Hey y'all,

It seems like currently, there is no way to notify a user to download a new ipa or apk file when appCenter has been updated similar to what we see in MSDistribute and DistributeListener interfaces found here:

Is this a planned feature?

@elamalani
Copy link
Contributor

@frankenthumbs We don't support In-app updates in RN SDK at the moment. We'll add it to our backlog but there is no ETA.

In the meantime, you can use CodePush service to update your application directly on users devices. You can find more information here - https://docs.microsoft.com/en-us/appcenter/distribution/codepush/

@justinmahood
Copy link

Any updates ? Curious if this is on the roadmap.

@elamalani
Copy link
Contributor

@justinmahood This is not in our mid-term roadmap. We suggest using our Distribute CodePush service for updates in your RN app.

@deregtd
Copy link

deregtd commented Sep 12, 2018

This doesn't help for native code updates backing RN apps, and really hinders quick adoption of internal builds. :( Have been so excited using the rest of the appcenter stuff, very disappointed to not have in app updates here. Maybe better to switch back to hockeyapp until the SDK supports it.

@deregtd
Copy link

deregtd commented Sep 12, 2018

I went through some of the basic AppCenter Distribute install instructions here for iOS, and adapted others:
https://docs.microsoft.com/en-us/appcenter/sdk/distribute/ios

  • I added the pod
  • Added the plist entry (don't know if that's still needed or not, haven't tried without yet)
  • In my AppDelegate.m, added:
#import <AppCenter/AppCenter.h>
#import <AppCenterDistribute/AppCenterDistribute.h>
...
// Boilerplate from the RN install:
  [AppCenterReactNativeCrashes registerWithAutomaticProcessing];  // Initialize AppCenter crashes

  [AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];  // Initialize AppCenter analytics

  [AppCenterReactNative register];  // Initialize AppCenter 

// Added this
  [MSAppCenter startService:[MSDistribute class]];

I then went ahead and compiled it and pushed to a branch of my VSTS repo, then queued a build to push to app center (with sequential version numbers). Installed and ran it and it had me login as normal and closed the webview. Then queued a second build fo the same code, had it push to app center, then foregrounded the app on iOS and it popped up the automatic update prompt dialog!

@guperrot
Copy link
Member

@deregtd glad it worked for you that way. I would add to make sure the version of distribute module matches the version of AppCenter/Core to avoid undefined behaviors (check that after every update of the npms).

Also for Android, adding

dependencies {
   def appCenterSdkVersion = 'sameVersionAsAppCenter Java, Not ReactNative'
   implementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"
}

The right version should be extracted from the appcenter build.gradle file and from the compile 'com.microsoft.appcenter:appcenter:version' line that does not have react-native in the package name.

And in MainApplication.java in onCreate:

AppCenterReactNativeShared.configureAppCenter(this);
AppCenter.start(Distribute.class);

Should work too.

@johannesloher
Copy link

Hey everybody,

I am also very much interested in this feature. We have changes to our native code quite frequently, so using only CodePush is not enough. At the moment we are still using HockeyApp, but we are considering switching to App Center soon. Not being able to distribute builds could be a major blocker for this.

I know that as @deregtd and @guperrot described, we can work around this by simply using the native ios and android sdks. But I would still much prefer a solution which is integrated into the react-native sdk. It just looks much cleaner.

Any update on if this is being worked on / on the roadmap?

@elamalani
Copy link
Contributor

@johannesloher Unfortunately, it's currently not on our roadmap to support in-app updates in React Native SDK. The solution is to either use CodePush or the feature directly from native iOS or Android SDK. We will keep this thread posted once we decide to support it in the SDK.

@johannesloher
Copy link

That's unfortunate, but thanks for your quick reply. I believe we can live with the workaround.

@Jalson1982
Copy link

   def appCenterSdkVersion = 'sameVersionAsAppCenter Java, Not ReactNative'
   implementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"

Hello. I am trying to setup this in my android app but have issues. I added in gradle
def appCenterSdkVersion = '1.11.2'
implementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"
and in MainApplication java added AppCenter.start(Distribute.class); It build app but no updates I can not see . Can you please help?

@annakocheshkova
Copy link

Hi @Jalson1982, can you share VERBOSE logs with me?

@jordanwise
Copy link

@Jalson1982 you also need the lines (as @guperrot mentioned, but without the extra import)

import com.microsoft.appcenter.reactnative.shared.AppCenterReactNativeShared;
...
   AppCenterReactNativeShared.configureAppCenter(this);

@fabiendem
Copy link

Hello, am wondering if you're still not considering this on your roadmap.
Thanks :)

@fabiendem
Copy link

I made an attempt at writing a wrapper for AppCenter Distribute. Focusing on Android for now.
I got something working, but in my scenario, I want to initialize AppCenter Distribute from the React/JS layer.

Problem is that the AppCenter Android SDK 2.3.0 relies on the onStart() and onResume() lifecycle of the main Activity to trigger the check for an update, there is no method to check manually.

By the time we want to initialize AppCenter from the React layer, onStart() has already been called.
The only way to trigger the check for an update was to send the app to the background and then back to the foreground to trigger the onResume callback.
This is fairly suboptimal in terms of UX.
Calling via the bridge
Distribute.getInstance() .onActivityResumed(this.reactContext.getCurrentActivity()); can work, but it's frankly a big dirty.

@guperrot
Copy link
Member

To be supported officially it would need to be a native module just like we did for Analytics where we also rely on onResume.
By initializing code from the native module the same way as Analytics the event will not be missed.

Now in the meantime the simplest way is to probably to modify MainApplication.java and do add

AppCenterReactNativeShared.configureAppCenter(application);
AppCenter.start(Distribute.class);

Before SoLoader.init(this, /* native exopackage */ false);.

The onResume event will not be missed by the module that way.

@fabiendem
Copy link

Thanks for the reply 👍

Yeah to get something working instead I have used directly the AppCenter Android SDK, rather than the ReactNative SDK.

Problem with the snippet above and the onResume is that we cannot control the AppCenter.start(Distribute.class); call from the React/Js level.
By this I mean start it when we want once the React layer is ready and from the React layer, say in your <App /> component.
But maybe that's not a great idea 🤷‍♂

@guperrot
Copy link
Member

Even when using the Java Android SDK in java/kotlin apps there is no manual check, it's done when the app resumes. So that means there is no API to bind from Javascript just yet, it's only about setting up and lifecycle in the native code.

If you want to control whether the SDK is enabled or not, that's a different story. You could do the same thing as we do for Analytics where we can configure it to be disabled by default and expose Javascript method to wrap the setEnabled call. If that's the use case you can write a native module equivalent to Analytics.

@fabiendem
Copy link

Thanks.

In the above, I am more interested in initializing AppCenter Distribute from the JS layer and the manual check scenario (not relying on the Activity lifecycle). Not really whether the SDK is enabled or not.

In the unofficial HockeyApp react-native wrapper it's corresponding to those methods:
https://github.com/martincik/react-native-hockeyapp/blob/1d37936588a654c10ca8d8e7d67c5c52cdb5a3c0/index.js#L28-L31
https://github.com/martincik/react-native-hockeyapp/blob/1d37936588a654c10ca8d8e7d67c5c52cdb5a3c0/index.js#L36-L39

But meanwhile, I can totally work with the AppCenter Android native SDK.
I will keep an eye on this repo 👍

@robertontiu
Copy link

Any news on this? Is it still not supported for React Native?

@johanarnor
Copy link

johanarnor commented Feb 18, 2021

We didn't really need any AppCenter specific features, so we simply switched to Applivery which seems to work quite well with React Native.

@DmitriyKirakosyan
Copy link
Contributor

Hi guys,

Please kindly note that our team is focused on improving reliability and performance for App Center to around mid-2021. Because of this, we won't be making much progress around most feature requests.
Read more here.

@tutts
Copy link

tutts commented Mar 18, 2021

Has anyone had any success with @deregtd's approach with Private groups at all? I've tried to set the updateTrack before starting the service, but the auth page it mentions in the docs doesn't appear, my hunch is that the native auth view in the Distribute SDK isn't playing nicely with the React Bridge, where as Public dist track just uses the system alert dialog.

  [AppCenterReactNative register];
  [AppCenterReactNativeAnalytics registerWithInitiallyEnabled:true];
  [AppCenterReactNativeCrashes registerWithAutomaticProcessing];

  MSACDistribute.updateTrack = MSACUpdateTrackPrivate;
  [MSACAppCenter startService:[MSACDistribute class]];

I tried setting the delegate to self within AppDelegate.m after adding the MSACDistributeDelegate protocol in the header file. Still no luck though

#import <React/RCTBridgeDelegate.h>
#import <UIKit/UIKit.h>
#import <AppCenterDistribute/AppCenterDistribute.h>

@interface AppDelegate : UIResponder <UIApplicationDelegate, RCTBridgeDelegate, MSACDistributeDelegate>

@property (nonatomic, strong) UIWindow *window;

@end
  [MSACDistribute setDelegate:self];
  MSACDistribute.updateTrack = MSACUpdateTrackPrivate;
  [MSACAppCenter startService:[MSACDistribute class]];

@DmitriyKirakosyan
Copy link
Contributor

As we do not have plans to add support for this feature in the next year, I'm closing the issue.

@DmitriyKirakosyan DmitriyKirakosyan closed this as not planned Won't fix, can't repro, duplicate, stale Apr 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests