public void Init() { StringBuilder _appCenterBuild = new StringBuilder(); if (!String.IsNullOrEmpty(GlobalSetting.Instance.AppCenterAndroidKey)) { _appCenterBuild.Append($"android={GlobalSetting.Instance.AppCenterAndroidKey}"); } if (!String.IsNullOrEmpty(GlobalSetting.Instance.AppCenteriOSKey)) { _appCenterBuild.Append($"ios={GlobalSetting.Instance.AppCenteriOSKey}"); } if (!String.IsNullOrEmpty(GlobalSetting.Instance.AppCenterUWPKey)) { _appCenterBuild.Append($"uwp={GlobalSetting.Instance.AppCenterUWPKey}"); } if (String.IsNullOrEmpty(_appCenterBuild.ToString())) { throw new Exception("You have to set AppCenter secret key"); } if (!GlobalSetting.Instance.IsTest) { Distribute.CheckForUpdate(); } Microsoft.AppCenter.AppCenter.Start(_appCenterBuild.ToString(), typeof(Analytics), typeof(Crashes), typeof(Distribute)); }
/// <summary> /// Application developers override this method to perform actions when the application starts. /// </summary> /// <remarks> /// To be added. /// </remarks> protected override async void OnStart() { // TODO: Logging Console.WriteLine("In On Start"); if (App.Configuration != null) { if (App.Configuration.EnableAutoUpdates) { Distribute.SetEnabledAsync(true).Wait(); Distribute.CheckForUpdate(); } else { Distribute.DisableAutomaticCheckForUpdate(); } Distribute.ReleaseAvailable = this.OnReleaseAvailable; Distribute.UpdateTrack = UpdateTrack.Public; AppCenter.Start("android=10210e06-8a11-422b-b005-14081dc56375;", typeof(Distribute)); } // Handle when your app starts ILoginPresenter loginPresenter = App.Container.Resolve <ILoginPresenter>(); // show the login page await loginPresenter.Start(); }
protected override void OnStart() { AppCenter.Start("android=7011b0df-8bdb-481d-97c0-ff484ec4284e;", typeof(Analytics), typeof(Crashes), typeof(Distribute)); AppCenter.LogLevel = LogLevel.Verbose; Distribute.CheckForUpdate(); }
public MainPage() { InitializeComponent(); CheckAppUpdateButton.Clicked += (s, e) => { Distribute.CheckForUpdate(); }; }
protected override void OnStart() { const string ios = "b9f253ab-47e9-40bd-892b-f1687efe3ebc"; const string android = "382f69c3-84d5-4037-9743-dbab28403e1a"; AppCenter.Start($"ios={ios};android={android};", typeof(Analytics), typeof(Crashes), typeof(Distribute)); Distribute.CheckForUpdate(); }
public async Task CheckForUpdateTest(UpdateTrack updateTrack, string urlDiff) { // Enable Distribute for debuggable builds. DistributeEvent?.Invoke(this, DistributeTestType.EnableDebuggableBuilds); // Setup network adapter. var httpNetworkAdapter = new HttpNetworkAdapter(); DependencyConfiguration.HttpNetworkAdapter = httpNetworkAdapter; var implicitCheckForUpdateTask = httpNetworkAdapter.MockRequest(request => request.Method == "GET" && request.Uri.Contains(urlDiff)); var startServiceTask = httpNetworkAdapter.MockRequestByLogType("startService"); // Start AppCenter. AppCenter.UnsetInstance(); AppCenter.LogLevel = LogLevel.Verbose; Distribute.UpdateTrack = updateTrack; // Save update token. if (updateTrack == UpdateTrack.Private) { DistributeEvent?.Invoke(this, DistributeTestType.SaveMockUpdateToken); } AppCenter.Start(Config.ResolveAppSecret(), typeof(Distribute)); // Wait for "startService" log to be sent. await startServiceTask; DistributeEvent?.Invoke(this, DistributeTestType.OnResumeActivity); // Wait when Distribute will start. await Distribute.IsEnabledAsync(); // Wait for processing event. var resultImplicit = await implicitCheckForUpdateTask; // Verify response. Assert.Equal("GET", resultImplicit.Method); Assert.Contains(urlDiff, resultImplicit.Uri); Assert.Contains(Config.ResolveAppSecret(), resultImplicit.Uri); // Wait a 5s for give time to complete internal processes // to avoid this case `A check for update is already ongoing.` await Task.Delay(5000); // Check for update. var explicitCheckForUpdateTask = httpNetworkAdapter.MockRequest(request => request.Method == "GET" && request.Uri.Contains(urlDiff)); Distribute.CheckForUpdate(); // Wait for processing event. var resultExplicit = await explicitCheckForUpdateTask; // Verify response. Assert.Equal("GET", resultExplicit.Method); Assert.Contains(urlDiff, resultExplicit.Uri); Assert.Contains(Config.ResolveAppSecret(), resultExplicit.Uri); }
public async Task CheckForUpdateTest(UpdateTrack updateTrack, string urlDiff) { // Enable Distribute for debuggable builds. DistributeEvent?.Invoke(this, DistributeTestType.EnableDebuggableBuilds); // Setup network adapter. var httpNetworkAdapter = new HttpNetworkAdapter(); DependencyConfiguration.HttpNetworkAdapter = httpNetworkAdapter; HttpResponse response = new HttpResponse() { Content = GetReleaseJson("30", "3.0.0", false, 19), StatusCode = 200 }; var implicitCheckForUpdateTask = httpNetworkAdapter.MockRequest(request => request.Method == "GET"); var explicitCheckForUpdateTask = httpNetworkAdapter.MockRequest(request => request.Method == "GET", response); var startServiceTask = httpNetworkAdapter.MockRequestByLogType("startService"); // Start AppCenter. AppCenter.UnsetInstance(); AppCenter.LogLevel = LogLevel.Verbose; Distribute.UpdateTrack = updateTrack; // Save update token. if (updateTrack == UpdateTrack.Private) { DistributeEvent?.Invoke(this, DistributeTestType.SaveMockUpdateToken); } AppCenter.Start(Config.ResolveAppSecret(), typeof(Distribute)); // Wait for "startService" log to be sent. await startServiceTask; DistributeEvent?.Invoke(this, DistributeTestType.OnResumeActivity); // Wait when Distribute will start. await Distribute.IsEnabledAsync(); // Wait for processing event. var result = await implicitCheckForUpdateTask; // Verify response. Assert.Equal("GET", result.Method); Assert.True(result.Uri.Contains(urlDiff)); Assert.True(result.Uri.Contains(Config.ResolveAppSecret())); // Check for update. Distribute.CheckForUpdate(); // Wait for processing event. result = await explicitCheckForUpdateTask; // Verify response. Assert.Equal("GET", result.Method); Assert.True(result.Uri.Contains(urlDiff)); Assert.True(result.Uri.Contains(Config.ResolveAppSecret())); }
public App() { InitializeComponent(); MainPage = new Views.Dashboard.MainPage(); _buildNum = "Changes V1.8.0"; Distribute.CheckForUpdate(); }
public async Task DisableAuthomaticCheckUpdateTest() { // Enable Distribute for debuggable builds. DistributeEvent?.Invoke(this, DistributeTestType.EnableDebuggableBuilds); // Setup network adapter. var httpNetworkAdapter = new HttpNetworkAdapter(); DependencyConfiguration.HttpNetworkAdapter = httpNetworkAdapter; HttpResponse response = new HttpResponse() { Content = GetReleaseJson("30", "3.0.0", false, 19), StatusCode = 200 }; var explicitCheckForUpdateTask = httpNetworkAdapter.MockRequest(request => request.Method == "GET", response, 30); var startServiceTask = httpNetworkAdapter.MockRequestByLogType("startService"); // Start AppCenter. AppCenter.UnsetInstance(); AppCenter.LogLevel = LogLevel.Verbose; Distribute.DisableAutomaticCheckForUpdate(); AppCenter.Start(Config.ResolveAppSecret(), typeof(Distribute)); // Wait for "startService" log to be sent. await startServiceTask; Assert.Equal(1, httpNetworkAdapter.CallCount); DistributeEvent?.Invoke(this, DistributeTestType.OnResumeActivity); // Wait when Distribute will start. await Distribute.IsEnabledAsync(); // Wait a 5s and verify that we will not have new calls. await Task.Delay(5000); Assert.Equal(1, httpNetworkAdapter.CallCount); // Check for update. Distribute.CheckForUpdate(); // Wait for processing event. var result = await explicitCheckForUpdateTask; // Verify response. Assert.Equal(2, httpNetworkAdapter.CallCount); Assert.Equal("GET", result.Method); Assert.True(result.Uri.Contains("releases/latest")); Assert.True(result.Uri.Contains(Config.ResolveAppSecret())); }
/// <summary> /// Initialize App Center. /// </summary> private static void AppCenterInit() { string initString = "uwp=" + Secret.UWPSecret + ";" + "android=" + Secret.AndroidSecret + ";" + "ios=" + Secret.IOSSecret; Debug.WriteLine(initString, "AppCenterInit"); AppCenter.LogLevel = LogLevel.Verbose; AppCenter.Start(initString, typeof(Analytics), typeof(Crashes), typeof(Distribute)); Distribute.SetEnabledAsync(true); Distribute.CheckForUpdate(); }
void CheckForUpdateClicked(object sender, EventArgs e) { Distribute.CheckForUpdate(); }
private void CheckForUpdate(object obj) { Distribute.CheckForUpdate(); }
public static void CheckForNewVersion() => Distribute.CheckForUpdate();